home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Asm / AB3DIIsrc / source_4000 / Multiplay.s < prev    next >
Encoding:
Text File  |  1996-07-29  |  255.0 KB  |  17,237 lines

  1. CHEESEY equ 0
  2.  
  3. *************************************************
  4. * Stuff to do to get a C2P version:
  5. * Change copperlist
  6. * Change wall drawing
  7. * change floor drawing
  8. * change object drawing
  9. * change polygon drawing (ugh)
  10. * Write a palette generator program in AMOS
  11. * to provide a good 256 colour palette and
  12. * convert all graphics files specified
  13. * (possibly included in the game linker
  14. * program).
  15. * Possibly change the wall/floor/object
  16. * palettes to look nicer with more shades.
  17. * RE-implement stippling (if not present)
  18. * as it will look gorgeous now.
  19. *************************************************
  20.  
  21. ;MIDDLEX set 96
  22. ;RIGHTX set 191
  23. ;BOTTOMY set 160 
  24.  
  25. ;MIDDLEX set 96
  26. ;RIGHTX set 191
  27. ;BOTTOMY set 160
  28.  
  29. _break    macro
  30. ;    bkpt    \1
  31.     endm
  32.  
  33.  
  34. FILTER    macro
  35. ;    move.l    d0,-(sp)
  36. ;    move.l    #65000,d0
  37. ;.loop\@
  38. ;    bchg    #1,$bfe001
  39. ;    dbra    d0,.loop\@
  40. ;    move.l    (sp)+,d0
  41.     endm
  42.  
  43. BLACK    macro
  44.     move.w    #0,$dff180
  45.     endm
  46.  
  47. RED    macro
  48.     move.w    #$f00,$dff180
  49.     endm
  50.  
  51. FLASHER macro
  52. ;    movem.l    d1,-(sp)
  53. ;    move.w    #-1,d1
  54. ;
  55. ;loop3\@
  56. ;;    move.w    #\1,$dff180
  57. ;    nop
  58. ;    nop
  59. ;    move.w    #\2,$dff180
  60. ;    nop
  61. ;    nop
  62. ;    dbra    d1,loop3\@
  63.  
  64. ;    movem.l    (sp)+,d1
  65.  
  66.     endm
  67.  
  68. GREEN    macro
  69.     move.w    #$0f0,$dff180
  70.     endm
  71.  
  72. BLUE    macro
  73.     move.w    #$f,$dff180
  74.     endm
  75.  
  76. DataCacheOff macro
  77.     movem.l    a0-a6/d0-d7,-(sp)
  78.     move.l    4.w,a6
  79.     moveq    #0,d0
  80.     move.l    #%0000000100000000,d1
  81.     jsr    _LVOCacheControl(a6)
  82.     movem.l    (sp)+,a0-a6/d0-d7
  83.     endm
  84.  
  85. DataCacheOn macro
  86.     movem.l    a0-a6/d0-d7,-(sp)
  87.     move.l    4.w,a6
  88.     moveq    #-1,d0
  89.     move.l    #%0000000100000000,d1
  90.     jsr    _LVOCacheControl(a6)
  91.     movem.l    (sp)+,a0-a6/d0-d7
  92.     endm
  93.  
  94.     opt    P=68020
  95.  
  96.     include utils:sysinc/hardware/intbits.i
  97.  
  98. CD32VER equ 0
  99.  
  100. maxscrdiv EQU 8
  101. max3ddiv EQU 5
  102. playerheight EQU 12*1024
  103. playercrouched EQU 8*1024
  104. scrheight EQU 80
  105.  
  106. ; k/j/m
  107.  
  108. ; 4/8
  109. ; s/x
  110. ; b/n
  111.  
  112. midoffset EQU 104*4*40
  113.  
  114.  
  115.  SECTION Scrn,CODE
  116. OpenLib       equ -552
  117. CloseLib      equ -414
  118.  
  119. INTREQ        equ    $09C
  120. INTENA        equ    $09A
  121. INTENAR    equ    $01C
  122. DMACON        equ    $096
  123.  
  124. SERPER        equ    $032
  125. SERDATR    equ    $018
  126. SERDAT        equ    $030
  127. vhposr        equ $006    
  128. vhposrl    equ $007 
  129.  
  130. bltcon0    equ $40 
  131. bltcon1    equ $42
  132. bltcpt        equ $48
  133. bltbpt        equ $4c
  134. bltapt        equ $50
  135. spr0ctl    equ $142
  136. spr1ctl    equ $14a
  137. spr2ctl    equ $152
  138. spr3ctl    equ $15a
  139. spr4ctl    equ $162
  140. spr5ctl    equ $16a
  141. spr6ctl    equ $172
  142. spr7ctl    equ $17a
  143. spr0pos    equ $140
  144. spr1pos    equ $148
  145. spr2pos    equ $150
  146. spr3pos    equ $158
  147. spr4pos    equ $160
  148. spr5pos    equ $168
  149. spr6pos    equ $170
  150. spr7pos    equ $178
  151. bltdpt         equ $54
  152. bltafwm    equ $44
  153. bltalwm    equ $46
  154. bltsize         equ $58
  155. bltcmod         equ $60
  156. bltbmod         equ $62
  157. bltamod         equ $64
  158. bltdmod         equ $66
  159. diwstart        equ $8e         ; Screen hardware registers.
  160. diwstop         equ $90
  161. ddfstart        equ $92
  162. ddfstop         equ $94
  163. bplcon0         equ $100
  164. bplcon1         equ $102
  165. col0            equ $180
  166. col1            equ $182
  167. col2        equ $184
  168. col3        equ $186
  169. col4        equ $188
  170. col5        equ $18a
  171. col6        equ $18c
  172. col7        equ $18e
  173. col8            equ $190
  174. col9            equ $192
  175. col10           equ $194
  176. col11           equ $196
  177. col12           equ $198
  178. col13           equ $19a
  179. dmacon        equ $96
  180. dmaconr        equ $002
  181. intenar        equ $01c
  182. intena        equ $09a
  183. intreq        equ $09c
  184. intreqr        equ $01e
  185. intreqrl    equ $01f
  186. bpl1pth         equ $e0
  187. bpl1ptl         equ $e2
  188. bpl2pth        equ $e4
  189. bpl2ptl        equ $e6
  190. bpl3pth        equ $e8
  191. bpl3ptl        equ $ea
  192. bpl4pth        equ $ec
  193. bpl4ptl        equ $ee
  194. bpl5pth        equ $f0
  195. bpl5ptl        equ $f2
  196. bpl6pth        equ $f4
  197. bpl6ptl        equ $f6
  198. bpl7pth        equ $f8
  199. bpl7ptl        equ $fa
  200. bpl8pth        equ $fc
  201. bpl8ptl        equ $fe
  202. spr0pth        equ $120
  203. spr0ptl        equ $122
  204. spr1pth        equ $124
  205. spr1ptl        equ $126
  206. spr2pth        equ $128
  207. spr2ptl        equ $12a
  208. spr3pth        equ $12c
  209. spr3ptl        equ $12e
  210. spr4pth        equ $130
  211. spr4ptl        equ $132
  212. spr5pth        equ $134
  213. spr5ptl        equ $136
  214. spr6pth        equ $138
  215. spr6ptl        equ $13a
  216. spr7pth        equ $13c
  217. spr7ptl        equ $13e
  218. adkcon        equ   $09E
  219.  
  220.  
  221. ; move.l #length,d0
  222. ; moveq.l #2,d1    ; chipmem
  223. ; move.l 4.w,a6
  224. ; jsr allocmem(a6) = -198
  225.  
  226. ; tst.l d0
  227. ; beq.s ohbugger
  228. ; move.l d0,memaddr
  229.  
  230.  
  231. ; move.l 4.w,a6
  232. ; move.l memaddr,a1
  233. ; move.l #size,d0
  234. ; jsr freemem(a6) =-210
  235.  
  236.  
  237. ** This waits for the blitter to finish before allowing program
  238. ** execution to continue.
  239.  
  240.  
  241.  include "ab3:source_4000/protsetupdecode"
  242.  
  243. SAVEREGS MACRO
  244.  movem.l d0-d7/a0-a6,-(a7)
  245.  ENDM
  246.  
  247. GETREGS MACRO
  248.  movem.l (a7)+,d0-d7/a0-a6
  249.  ENDM
  250.  
  251.  
  252. WB MACRO
  253. \@bf:
  254.  btst #6,dmaconr(a6)
  255.  bne.s \@bf
  256.  ENDM
  257.  
  258. WBa MACRO
  259. \@bf:
  260.  move.w #\2,$dff180
  261.  
  262.  btst #6,$bfe001
  263.  bne.s \@bf
  264. \@bz:
  265.  
  266.  move.w #$f0f,$dff180
  267.  
  268.  btst #6,$bfe001
  269.  beq.s \@bz
  270.  
  271.  ENDM
  272.  
  273. *Another version for when a6 <> dff000
  274.  
  275. WBSLOW MACRO
  276. \@bf:
  277.  btst #6,$dff000+dmaconr
  278.  bne.s \@bf
  279.  ENDM
  280.  
  281. WT MACRO
  282. \@bf:
  283.  btst #6,(a3)
  284.  bne.s \@bd
  285.  rts
  286. \@bd: 
  287.  btst #4,(a0)
  288.  beq.s \@bf
  289.  ENDM
  290.  
  291. WTNOT MACRO
  292. \@bf:
  293.  btst #6,(a3)
  294.  bne.s \@bd
  295.  rts
  296. \@bd: 
  297.  btst #4,(a0)
  298.  bne.s \@bf
  299.  ENDM
  300.  
  301. **
  302.  
  303.  include "ab3:source_4000/ProtectionProtection"
  304.  include "macros.i"
  305.  include "ab3:source_4000/defs.i"
  306.  
  307. ;wtclickk:
  308. ; btst #6,$bfe001
  309. ; bne.s wtclickk
  310.  
  311.  move.w (a0)+,WHICHAMI
  312.  
  313.  cmp.b #'2',WHICHAMI
  314.  bne.s nomas
  315.  jsr InitParMaster
  316. nomas
  317.  
  318.  cmp.b #'3',WHICHAMI
  319.  bne.s noslave
  320.  jsr InitParSlave
  321. noslave:
  322.  
  323.  
  324.  jsr MakePatch
  325.  
  326. ;    FLASHER $0f0,$fff
  327.  
  328. ; PROTFCALC
  329. ; PROTGCALC
  330. ; PROTHCALC
  331. ; PROTICALC
  332. ; PROTKCALC
  333. ; PROTLCALC
  334. ; PROTMCALC
  335.  
  336.  
  337.  
  338.  move.l #$dff000,a6    ; NB V. IMPORTANT: A6=CUSTOM BASE
  339.  move.w intenar(a6),_storeint
  340.  and.w #$c000,_storeint
  341.  
  342.  move.w #31,SERPER(a6)    ;19200 baud, 8 bits, no parity
  343.  
  344.  
  345.  st GOURSEL
  346.  
  347.  
  348.  move.l 4.w,a6
  349.  lea VBLANKInt(pc),a1
  350.  moveq #INTB_COPER,d0
  351.  jsr _LVOAddIntServer(a6)
  352.  
  353.     IFEQ CD32VER
  354.  move.l 4.w,a6
  355.  lea KEYInt(pc),a1
  356.  moveq #INTB_PORTS,d0
  357.  jsr _LVOAddIntServer(a6)
  358.     ENDC
  359.  
  360.  WBSLOW
  361.  
  362.  
  363.  IFNE CD32VER
  364.  clr.b PLR1KEYS
  365.  clr.b PLR1PATH
  366.  clr.b PLR1MOUSE
  367.  st PLR1JOY
  368.  clr.b PLR2KEYS
  369.  clr.b PLR2PATH
  370.  clr.b PLR2MOUSE
  371.  st PLR2JOY
  372.  ELSE
  373.  st PLR1KEYS
  374.  clr.b PLR1PATH
  375.  clr.b PLR1MOUSE
  376.  clr.b PLR1JOY
  377.  st PLR2KEYS
  378.  clr.b PLR2PATH
  379.  clr.b PLR2MOUSE
  380.  clr.b PLR2JOY
  381.  ENDC
  382.  
  383.  PRSDO
  384.  
  385.  move.l #2,d1    
  386.  move.l #10280*2,d0
  387.  move.l 4.w,a6
  388.  jsr -198(a6)
  389.  move.l d0,TEXTSCRN
  390.  move.w d0,TSPTl
  391.  swap d0
  392.  move.w d0,TSPTh
  393.  swap d0
  394.  add.w #80,d0
  395.  move.w d0,TSPTl2
  396.  swap d0
  397.  move.w d0,TSPTh2
  398.  
  399.  move.l #nullspr,d0
  400.  move.w d0,txs0l
  401.  move.w d0,txs1l
  402.  move.w d0,txs2l
  403.  move.w d0,txs3l
  404.  move.w d0,txs4l
  405.  move.w d0,txs5l
  406.  move.w d0,txs6l
  407.  move.w d0,txs7l
  408.  swap d0
  409.  move.w d0,txs0h
  410.  move.w d0,txs1h
  411.  move.w d0,txs2h
  412.  move.w d0,txs3h
  413.  move.w d0,txs4h
  414.  move.w d0,txs5h
  415.  move.w d0,txs6h
  416.  move.w d0,txs7h 
  417.  
  418.  move.l #0,d1    
  419.  move.l #140000,d0
  420.  move.l 4.w,a6
  421.  jsr -198(a6)
  422.  move.l d0,LEVELDATA
  423.  
  424.  move.l #0,d1
  425.  
  426.  ifeq CHEESEY    
  427.  move.l #320*256,d0
  428.  endc
  429.  
  430.  ifne CHEESEY
  431.  move.l #320*160,d0
  432.  endc
  433.  
  434.  move.l 4.w,a6
  435.  jsr -198(a6)
  436.  move.l d0,FASTBUFFER
  437.  
  438.  
  439.  move.l #consttab,a0
  440.  moveq #1,d0
  441.  move.w #8191,d1
  442. fillconst:
  443.  
  444.  move.l #16384*64,d2
  445.  divs.l d0,d2
  446. ; ext.l d2    ;c#
  447.  move.l #64*64*65536,d3
  448.  divs.l d2,d3
  449. ; move.l d3,d4
  450. ; asr.l #6,d4
  451.  move.l d3,(a0)+    ;e#
  452.   
  453.  asr.l #1,d2    ; c#/2.0
  454.  sub.l #40*64,d2    ; d#
  455.  muls.l d3,d2    ; d#*e#
  456.  
  457.  asr.l #6,d2
  458.  move.l d2,(a0)+
  459.  
  460.  addq #1,d0
  461.  
  462.  dbra d1,fillconst
  463.  
  464.  jsr START
  465.  
  466.  rts
  467.  
  468. FASTBUFFER: dc.l 0
  469.  
  470. GUN_OBJ: dc.l 0
  471.  
  472. SYSTEMBLITINT: dc.l 0
  473.  
  474. _storeint
  475.     dc.w 0
  476.  
  477. * Load level into buffers.
  478.  clr.b doanything
  479.  clr.b dosounds
  480.  
  481. ; DRAW TEXT SCREEN
  482.  
  483. TWEENTEXT:
  484.  
  485.  move.l LEVELTEXT,a0
  486.  move.w PLOPT,d0
  487.  muls #82*16,d0
  488.  add.l d0,a0
  489.  
  490.  move.w #15,d7
  491.  move.w #0,d0
  492. DOWNTEXT:
  493.  move.l TEXTSCRN,a1
  494.  jsr DRAWLINEOFTEXT
  495.  addq #1,d0
  496.  add.w #82,a0
  497.  dbra d7,DOWNTEXT
  498.  rts
  499.  
  500. WHICHAMI: dc.b 0
  501. HOWMANY: dc.b 0
  502.  
  503. FONTADDRS:
  504.  dc.l ENDFONT0,CHARWIDTHS0
  505.  dc.l ENDFONT1,CHARWIDTHS1
  506.  dc.l ENDFONT2,CHARWIDTHS2
  507.  
  508. ENDFONT0:
  509.  incbin "endfont0"
  510. CHARWIDTHS0:
  511.  incbin "charwidths0"
  512. ENDFONT1:
  513. ; incbin "endfont1"
  514. CHARWIDTHS1:
  515. ; incbin "charwidths1"
  516. ENDFONT2:
  517. ; incbin "endfont2"
  518. CHARWIDTHS2:
  519. ; incbin "charwidths2"
  520.  
  521.  even
  522.  
  523. DRAWLINEOFTEXT:
  524.  movem.l d0/a0/d7,-(a7)
  525.  
  526.  muls #80*16,d0
  527.  add.l d0,a1    ; screen pointer
  528.  
  529.  move.l #FONTADDRS,a3
  530.  moveq #0,d0
  531.  move.b (a0)+,d0
  532.  move.l (a3,d0.w*8),a2
  533.  move.l 4(a3,d0.w*8),a3
  534.  
  535.  moveq #0,d4
  536.  
  537.  moveq #0,d1    ; width counter:
  538.  move.w #79,d6
  539.  tst.b (a0)+
  540.  beq.s NOTCENTRED
  541.  moveq #-1,d5
  542.  move.l a0,a4
  543.  moveq #0,d2
  544.  moveq #0,d3
  545.  move.w #79,d0    ; number of chars
  546. .addup:
  547.  addq #1,d5
  548.  move.b (a4)+,d2
  549.  move.b -32(a3,d2.w),d4
  550.  add.w d4,d3
  551.  cmp.b #32,d2
  552.  beq.s .DONTPUTIN
  553.  move.w d5,d6
  554.  move.w d3,d1
  555. .DONTPUTIN:
  556.  dbra d0,.addup
  557.  asr.w #1,d1
  558.  neg.w d1
  559.  add.w #320,d1    ; horiz pos of start x
  560.  
  561. NOTCENTRED:
  562.  move.w d6,d7
  563. DOACHAR:
  564.  moveq #0,d2
  565.  move.b (a0)+,d2
  566.  sub.w #32,d2
  567.  moveq #0,d6
  568.  move.b (a3,d2.w),d6
  569.  asl.w #5,d2
  570.  lea (a2,d2.w),a4    ; char font
  571. val SET 0
  572.  REPT 16
  573.  move.w (a4)+,d0
  574.  bfins d0,val(a1){d1:d6}
  575. val SET val+80
  576.  ENDR
  577.  add.w d6,d1
  578.  dbra d7,DOACHAR
  579.  movem.l (a7)+,d0/a0/d7
  580.  rts 
  581.  
  582.  
  583. CLRTWEENSCRN:
  584.  move.l TEXTSCRN,a0
  585.  move.w #(10240/16)-1,d0
  586.  move.l #$0,d1
  587. .lll
  588.  move.l d1,(a0)+
  589.  move.l d1,(a0)+
  590.  move.l d1,(a0)+
  591.  move.l d1,(a0)+
  592.  move.l d1,(a0)+
  593.  move.l d1,(a0)+
  594.  move.l d1,(a0)+
  595.  move.l d1,(a0)+
  596.  dbra d0,.lll
  597.  rts
  598.  
  599. LEVTOPLAY: dc.w 0
  600.  
  601. COPYLINK: dc.l 0
  602.  
  603. PLAYTHEGAME:
  604.  
  605.  move.w #0,TXTCOLL
  606.  move.w #0,MIXCOLL
  607.  move.w #0,TOPCOLL
  608.  
  609.  bsr CLRTWEENSCRN
  610.  
  611.  cmp.b #'n',mors
  612.  bne.s .notext
  613.  bsr TWEENTEXT
  614. .notext
  615.  
  616. ;charlie 
  617.  move.l #TEXTCOP,$dff080
  618.  
  619.  move.w #$10,d0
  620.  move.w #7,d1
  621.  
  622. .fdup
  623.  move.w d0,TXTCOLL
  624.  move.w d0,MIXCOLL
  625.  add.w #$121,d0
  626. .wtframe:
  627.  btst #5,$dff000+intreqrl
  628.  beq.s .wtframe
  629.  move.w #$0020,$dff000+intreq
  630.  dbra d1,.fdup
  631.  
  632.  
  633.  jsr INITCOPPERSCRN
  634.  
  635.  move.l #$dff000,a6
  636.  jsr SETPLAYERS
  637.  
  638.  move.l #0,TYPEOFMEM
  639.  move.l #LLname,a0
  640.  jsr LOADAFILE
  641.  move.l d0,LINKS
  642.  
  643.  move.l #0,TYPEOFMEM
  644.  move.l #LLFname,a0
  645.  jsr LOADAFILE
  646.  move.l d0,FLYLINKS
  647.  
  648. ; Get level memory.
  649.  
  650.  move.l #1,d1
  651.  move.l #40000,d0
  652.  move.l 4.w,a6
  653.  jsr -198(a6)
  654.  move.l d0,LEVELGRAPHICS
  655.  
  656.  move.l #1,d1
  657.  move.l #40000,d0
  658.  move.l 4.w,a6
  659.  jsr -198(a6)
  660.  move.l d0,LEVELCLIPS
  661.  
  662.  move.l #2,d1
  663.  move.l #70000,d0
  664.  move.l 4.w,a6
  665.  jsr -198(a6)
  666.  move.l d0,LEVELMUSIC
  667.  
  668.  move.l #$dff000,a6
  669.  
  670. ; move.b LEVTOPLAY,d0
  671. ; move.b d0,LEVA
  672. ; move.b d0,LEVB
  673. ; move.b d0,LEVC
  674. ; move.b d0,LEVD
  675. ; move.b d0,LEVE
  676.  
  677.  
  678. ; move.l #LEVELDATAD,LEVELDATA
  679. ; move.l #LEVELGRAPHICSD,LEVELGRAPHICS
  680. ; move.l #LEVELCLIPSD,LEVELCLIPS
  681.  
  682. ; bra noload
  683.  
  684. *********************************
  685.  
  686. ; move.l doslib,a6
  687. ; move.l #LLname,d1
  688. ; move.l #1005,d2
  689. ; jsr -30(a6)
  690. ; move.l d0,LLhandle
  691. ;
  692. ; move.l doslib,a6
  693. ; move.l d0,d1
  694. ; move.l #LINKS,d2
  695. ; move.l #10000,d3
  696. ; jsr -42(a6)
  697. ;
  698. ; move.l doslib,a6
  699. ; move.l LLhandle,d1
  700. ; jsr -36(a6)
  701.  
  702.  ********************************
  703.  
  704. ; move.l doslib,a6
  705. ; move.l #LLFname,d1
  706. ; move.l #1005,d2
  707. ; jsr -30(a6)
  708. ; move.l d0,LLhandle
  709.  
  710. ; move.l doslib,a6
  711. ; move.l d0,d1
  712. ; move.l #FLYLINKS,d2
  713. ; move.l #10000,d3
  714. ; jsr -42(a6)
  715.  
  716. ; move.l doslib,a6
  717. ; move.l LLhandle,d1
  718. ; jsr -36(a6)
  719.  
  720.  ************************
  721.  ********
  722.  
  723.  moveq #0,d1
  724.  move.b LEVA,d1
  725.  sub.b #'a',d1
  726.  lsl.w #6,d1
  727.  move.l LINKFILE,a6
  728.  add.l #LevelMusic,a6
  729.  add.l d1,a6
  730.  move.l a6,d1
  731.  
  732.  move.l doslib,a6
  733.  
  734.  move.l #1005,d2
  735.  jsr -30(a6)
  736.  move.l d0,LDhandle
  737.  
  738.  move.l doslib,a6
  739.  move.l d0,d1
  740.  move.l LEVELCLIPS,d2
  741.  move.l #40000,d3
  742.  jsr -42(a6)
  743.  
  744.  move.l doslib,a6
  745.  move.l LDhandle,d1
  746.  jsr -36(a6)
  747.  
  748. *************************************
  749.     move.l    LEVELCLIPS,d0
  750.     moveq    #0,d1
  751.     move.l LEVELMUSIC,a0
  752.     lea    WorkSpace,a1
  753.     lea    $0,a2
  754.     jsr    unLHA
  755. *************************************
  756.  
  757.  
  758.  move.l doslib,a6
  759.  move.l #LDname,d1
  760.  move.l #1005,d2
  761.  jsr -30(a6)
  762.  move.l d0,LDhandle
  763.  
  764.  move.l doslib,a6
  765.  move.l d0,d1
  766.  move.l LEVELCLIPS,d2
  767.  move.l #40000,d3
  768.  jsr -42(a6)
  769.  
  770.  move.l doslib,a6
  771.  move.l LDhandle,d1
  772.  jsr -36(a6)
  773.  
  774. *************************************
  775.     move.l    LEVELCLIPS,d0
  776.     moveq    #0,d1
  777.     move.l LEVELDATA,a0
  778.     lea    WorkSpace,a1
  779.     lea    $0,a2
  780.     jsr    unLHA
  781. *************************************
  782.  
  783. ********
  784.  
  785.  move.l doslib,a6
  786.  move.l #LGname,d1
  787.  move.l #1005,d2
  788.  jsr -30(a6)
  789.  move.l d0,LGhandle
  790.  
  791.  move.l doslib,a6
  792.  move.l d0,d1
  793.  move.l LEVELCLIPS,d2
  794.  move.l #40000,d3
  795.  jsr -42(a6)
  796.  
  797.  move.l doslib,a6
  798.  move.l LGhandle,d1
  799.  jsr -36(a6)
  800.  
  801. *************************************
  802.     move.l    LEVELCLIPS,d0
  803.     moveq    #0,d1
  804.     move.l LEVELGRAPHICS,a0
  805.     lea    WorkSpace,a1
  806.     lea    $0,a2
  807.     jsr    unLHA
  808. *************************************
  809.  
  810. ********
  811.  
  812.  move.l doslib,a6
  813.  move.l #LCname,d1
  814.  move.l #1005,d2
  815.  jsr -30(a6)
  816.  move.l d0,LChandle
  817.  
  818.  move.l doslib,a6
  819.  move.l d0,d1
  820.  move.l #WorkSpace+16384,d2
  821.  move.l #16000,d3
  822.  jsr -42(a6)
  823.  
  824.  move.l doslib,a6
  825.  move.l LChandle,d1
  826.  jsr -36(a6)
  827.  
  828. *************************************
  829.     move.l    #WorkSpace+16384,d0
  830.     moveq    #0,d1
  831.     move.l LEVELCLIPS,a0
  832.     lea    WorkSpace,a1
  833.     lea    $0,a2
  834.     jsr    unLHA
  835. *************************************
  836.  
  837.  
  838. *******
  839.  
  840. noload:
  841.  
  842. ********
  843.  
  844. ; move.l doslib,a6
  845. ; move.l #Prefsname,d1
  846. ; move.l #1005,d2
  847. ; jsr -30(a6)
  848. ; move.l d0,Prefshandle
  849.  
  850. ; move.l doslib,a6
  851. ; move.l d0,d1
  852. ; move.l #Prefsfile,d2
  853. ; move.l #50,d3
  854. ; jsr -42(a6)
  855.  
  856. ; move.l doslib,a6
  857. ; move.l Prefshandle,d1
  858. ; jsr -36(a6)
  859.  
  860. *******
  861.  
  862.  IFNE CD32VER
  863.  move.l doslib,a6
  864.  move.l #115,d1
  865.  jsr -198(a6)
  866.  ENDC
  867.  
  868.  
  869. ; move.l doslib,d0
  870. ; move.l d0,a1
  871. ; move.l 4.w,a6
  872. ; jsr CloseLib(a6)
  873.  
  874.  move.l #$dff000,a6
  875.  
  876. charlie:
  877. ; jmp  ENDGAMESCROLL
  878.  
  879.     move.w #$87c0,dmacon(a6)
  880.  
  881.     move.w    #%1000000000100000,dmacon(a6)
  882.  
  883. ; move.w intenar(a6),saveinters
  884.     
  885.     move.w #%00101111,intena(a6)
  886.  
  887.     move.w #255,adkcon(a6)
  888.  
  889.  
  890. *** Put myself in supervisor mode
  891.  
  892.  bra blag
  893. ; move.l $6c,d0
  894. ; move.l #blag,$6c
  895. ; move.w #$8010,intreq(a6)
  896.  
  897.  rts
  898.  
  899. saveit: ds.l 10
  900. doslibname: dc.b 'dos.library',0
  901.  even
  902. doslib: dc.l 0
  903.  
  904. mors: dc.w 0
  905.  
  906. LDname: dc.b 'tkg2:levels/level_'
  907. LEVA:
  908.  dc.b 'a/twolev.bin',0
  909.  even
  910. LDhandle: dc.l 0
  911. LGname: dc.b 'tkg2:levels/level_'
  912. LEVB:
  913.  dc.b 'a/twolev.graph.bin',0
  914.  even
  915. LGhandle: dc.l 0
  916. LCname: dc.b 'tkg2:levels/level_'
  917. LEVC:
  918.  dc.b 'a/twolev.clips',0
  919.  even
  920. LChandle: dc.l 0
  921. LLname: dc.b 'tkg2:levels/level_'
  922. LEVD:
  923.  dc.b 'a/twolev.map',0
  924.  even
  925. LLFname: dc.b 'tkg2:levels/level_'
  926. LEVE:
  927.  dc.b 'a/twolev.flymap',0
  928.  even
  929. LLhandle: dc.l 0
  930.  
  931.     cnop    0,4
  932.  
  933. Prefsname: dc.b 'ram:prefs',0
  934.  even
  935. Prefshandle: dc.l 0
  936.  
  937.  
  938.  even
  939.  
  940.  cnop 0,4
  941.  
  942. VBLANKInt:
  943.  dc.l 0,0
  944.  dc.b NT_INTERRUPT,9
  945.  dc.l Prefsname
  946.  dc.l 0
  947.  dc.l Chan0inter
  948.  
  949. KEYInt:
  950.  dc.l 0,0
  951.  dc.b NT_INTERRUPT,127
  952.  dc.l Prefsname
  953.  dc.l 0
  954.  dc.l key_interrupt
  955.  
  956. BLITInt:
  957.  dc.l 0,0
  958.  dc.b NT_INTERRUPT,127
  959.  dc.l Prefsname
  960.  dc.l 0
  961.  dc.l BlitterInterrupt
  962.  
  963.  
  964. blag:
  965. ; move.w #$10,intreq(a6)
  966. ; move.l d0,$6c
  967. ; move.w #$7fff,intena(a6)
  968.  
  969. ; move.w #$20,$dff1dc
  970.  
  971. ; move.l 4.w,a6
  972. ; lea VBLANKInt(pc),a1
  973. ; moveq #INTB_COPER,d0
  974. ; jsr _LVOAddIntServer(a6)
  975.  
  976. ****************************
  977. * Initialize level
  978. ****************************
  979. * Poke all clip offsets into
  980. * correct bit of level data.
  981. ****************************
  982.  move.l LEVELGRAPHICS,a0
  983.  move.l 12(a0),a1
  984.  add.l a0,a1
  985.  move.l a1,ZoneGraphAdds
  986.  move.l (a0),a1
  987.  add.l a0,a1
  988.  move.l a1,DoorData
  989.  move.l 4(a0),a1
  990.  add.l a0,a1
  991.  move.l a1,LiftData
  992.  move.l 8(a0),a1
  993.  add.l a0,a1
  994.  move.l a1,SwitchData
  995.  adda.w #16,a0
  996.  move.l a0,ZoneAdds
  997.  
  998.  move.l LEVELDATA,a4
  999.  lea 160*10(a4),a1
  1000.  
  1001.  lea 54(a1),a2
  1002.  move.l a2,CPtPos
  1003.  move.w 12(a1),NumCPts
  1004.  move.w 14(a1),NumLevPts
  1005.  
  1006.  move.l 16+6(a1),a2
  1007.  add.l a4,a2
  1008.  move.l a2,Points
  1009.  move.w 8+6(a1),d0
  1010.  lea 4(a2,d0.w*4),a2
  1011.  move.l a2,PointBrights
  1012.  move.w 16(a1),d0
  1013.  addq #1,d0
  1014.  muls #80,d0
  1015.  add.l d0,a2
  1016.  move.l a2,ZoneBorderPts
  1017.  
  1018.  move.l 20+6(a1),a2
  1019.  add.l a4,a2
  1020.  move.l a2,FloorLines
  1021.  move.w -2(a2),ENDZONE
  1022.  move.l 24+6(a1),a2
  1023.  add.l a4,a2
  1024.  move.l a2,ObjectData
  1025. *****************************************
  1026. * Just for charles
  1027.  
  1028. ; move.w #$6060,6(a2)
  1029. ; move.l #$d0000,8(a2)
  1030. ; sub.w #40,4(a2)
  1031. ; move.w #45*256+45,14(a2)
  1032. ****************************************
  1033.  move.l 28+6(a1),a2
  1034.  add.l a4,a2
  1035.  move.l a2,PlayerShotData
  1036.  move.l 32+6(a1),a2
  1037.  add.l a4,a2
  1038.  move.l a2,NastyShotData
  1039.  
  1040.  add.l #64*20,a2
  1041.  move.l a2,OtherNastyData
  1042.  
  1043.  move.l 36+6(a1),a2
  1044.  add.l a4,a2
  1045.  move.l a2,ObjectPoints  
  1046.  move.l 40+6(a1),a2
  1047.  add.l a4,a2
  1048.  move.l a2,d0
  1049.  move.l #PLR1_Obj,a2
  1050.  
  1051.  REPT 8
  1052.  move.l d0,(a2)+
  1053.  add.l #64,d0
  1054.  ENDR
  1055.  move.l d0,GUN_OBJ
  1056.  
  1057.  move.l 44+6(a1),a2
  1058.  add.l a4,a2
  1059.  move.l a2,PLR2_Obj
  1060.  move.w 14+6(a1),NumObjectPoints
  1061.  
  1062. ; bra noclips
  1063.   
  1064.  move.l LEVELCLIPS,a2
  1065.  moveq #0,d0
  1066.  move.w 10+6(a1),d7    ;numzones
  1067.  move.w d7,NUMZONES
  1068. assignclips:
  1069.  move.l (a0)+,a3
  1070.  add.l a4,a3    ; pointer to a zone
  1071.  adda.w #ToListOfGraph,a3 ; pointer to zonelist
  1072. dowholezone:
  1073.  tst.w (a3)
  1074.  blt.s nomorethiszone
  1075.  tst.w 2(a3)
  1076.  blt.s thisonenull
  1077.  
  1078.  move.l d0,d1
  1079.  asr.l #1,d1
  1080.  move.w d1,2(a3)
  1081.  
  1082. findnextclip:
  1083.  cmp.w #-2,(a2,d0.l)
  1084.  beq.s foundnextclip
  1085.  addq.l #2,d0
  1086.  bra.s findnextclip
  1087. foundnextclip
  1088.  addq.l #2,d0
  1089.  
  1090. thisonenull:
  1091.  addq #8,a3 
  1092.  bra.s dowholezone
  1093. nomorethiszone:
  1094.  dbra d7,assignclips
  1095.  
  1096.  lea (a2,d0.l),a2
  1097.  move.l a2,CONNECT_TABLE
  1098.  
  1099. noclips:
  1100.  
  1101. * Put in addresses of glowything
  1102.  
  1103.  
  1104. ************************************
  1105.  
  1106. ; cmp.b #'k',Prefsfile
  1107. ; bne.s nkb
  1108.  
  1109. ;nkb:
  1110. ; cmp.b #'m',Prefsfile
  1111. ; bne.s nmc
  1112. ; clr.b PLR1KEYS
  1113. ; clr.b PLR1PATH
  1114. ; st PLR1MOUSE
  1115. ; clr.b PLR1JOY
  1116. ;nmc:
  1117. ; cmp.b #'j',Prefsfile
  1118. ; bne.s njc
  1119. ; clr.b PLR1KEYS
  1120. ; clr.b PLR1PATH
  1121. ; clr.b PLR1MOUSE
  1122. ; st PLR1JOY
  1123. ;njc:
  1124.  
  1125.  clr.b PLR1_StoodInTop
  1126.  move.l #playerheight,PLR1s_height
  1127.  
  1128.  move.l #empty,pos1LEFT
  1129.  move.l #empty,pos2LEFT
  1130.  move.l #empty,pos1RIGHT
  1131.  move.l #empty,pos2RIGHT
  1132.  move.l #empty,pos0LEFT
  1133.  move.l #empty,pos3LEFT
  1134.  move.l #empty,pos0RIGHT
  1135.  move.l #empty,pos3RIGHT
  1136.  move.l #emptyend,Samp0endLEFT
  1137.  move.l #emptyend,Samp1endLEFT
  1138.  move.l #emptyend,Samp0endRIGHT
  1139.  move.l #emptyend,Samp1endRIGHT
  1140.  move.l #emptyend,Samp2endLEFT
  1141.  move.l #emptyend,Samp3endLEFT
  1142.  move.l #emptyend,Samp2endRIGHT
  1143.  move.l #emptyend,Samp3endRIGHT
  1144.  
  1145.  
  1146.  move.l #nullline,d0
  1147.  move.w d0,n1l
  1148.  swap d0
  1149.  move.w d0,n1h
  1150.  
  1151.  move.l Panel,d0
  1152.  move.w d0,p1l
  1153.  swap d0
  1154.  move.w d0,p1h
  1155.  swap d0
  1156.  add.l #40,d0
  1157.  move.w d0,p2l
  1158.  swap d0
  1159.  move.w d0,p2h
  1160.  swap d0
  1161.  add.l #40,d0
  1162.  move.w d0,p3l
  1163.  swap d0
  1164.  move.w d0,p3h
  1165.  swap d0
  1166.  add.l #40,d0
  1167.  move.w d0,p4l
  1168.  swap d0
  1169.  move.w d0,p4h
  1170.  swap d0
  1171.  add.l #40,d0
  1172.  move.w d0,p5l
  1173.  swap d0
  1174.  move.w d0,p5h
  1175.  swap d0
  1176.  add.l #40,d0
  1177.  move.w d0,p6l
  1178.  swap d0
  1179.  move.w d0,p6h
  1180.  swap d0
  1181.  add.l #40,d0
  1182.  move.w d0,p7l
  1183.  swap d0
  1184.  move.w d0,p7h
  1185.  swap d0
  1186.  add.l #40,d0
  1187.  move.w d0,p8l
  1188.  swap d0
  1189.  move.w d0,p8h
  1190.  
  1191. *******************************
  1192. * TIMER SCREEN SETUP
  1193. ; move.l #TimerScr,d0
  1194. ; move.w d0,p1l
  1195. ; swap d0
  1196. ; move.w d0,p1h
  1197. ; move.w #$1201,Panelcon
  1198.  
  1199. ; move.l #borders,d0
  1200. ; move.w d0,s0l
  1201. ; swap d0
  1202. ; move.w d0,s0h
  1203. ; move.l #borders+2592,d0
  1204. ; move.w d0,s1l
  1205. ; swap d0
  1206. ; move.w d0,s1h
  1207. ; move.l #borders+2592*2,d0
  1208. ; move.w d0,s2l
  1209. ; swap d0
  1210. ; move.w d0,s2h
  1211. ; move.l #borders+2592*3,d0
  1212. ; move.w d0,s3l
  1213. ; swap d0
  1214. ; move.w d0,s3h
  1215.  
  1216.  move.l #nullspr,d0
  1217.  move.w d0,s0l
  1218.  move.w d0,s1l
  1219.  move.w d0,s2l
  1220.  move.w d0,s3l
  1221.  
  1222.  move.w d0,s4l
  1223.  move.w d0,s5l
  1224.  move.w d0,s6l
  1225.  move.w d0,s7l
  1226.  swap d0
  1227.  
  1228.  move.w d0,s0h
  1229.  move.w d0,s1h
  1230.  move.w d0,s2h
  1231.  move.w d0,s3h
  1232.  
  1233.  move.w d0,s4h
  1234.  move.w d0,s5h
  1235.  move.w d0,s6h
  1236.  move.w d0,s7h 
  1237.  
  1238.  
  1239. ; move.w #52*256+64,borders
  1240. ; move.w #212*256+0,borders+8
  1241. ; move.w #52*256+64,borders+2592
  1242. ; move.w #212*256+128,borders+8+2592
  1243. ; move.w #52*256+192,borders+2592*2
  1244. ; move.w #212*256+0,borders+8+2592*2
  1245. ; move.w #52*256+192,borders+2592*3
  1246. ; move.w #212*256+128,borders+8+2592*3
  1247.  
  1248.  move.l #FacePlace,d0
  1249.  move.w d0,f1l
  1250.  swap d0
  1251.  move.w d0,f1h
  1252.  move.l #FacePlace+32*24,d0
  1253.  move.w d0,f2l
  1254.  swap d0
  1255.  move.w d0,f2h
  1256.  move.l #FacePlace+32*24*2,d0
  1257.  move.w d0,f3l
  1258.  swap d0
  1259.  move.w d0,f3h
  1260.  move.l #FacePlace+32*24*3,d0
  1261.  move.w d0,f4l
  1262.  swap d0
  1263.  move.w d0,f4h
  1264.  move.l #FacePlace+32*24*4,d0
  1265.  move.w d0,f5l
  1266.  swap d0
  1267.  move.w d0,f5h
  1268.   
  1269.  
  1270.  move.l #bigfield,d0
  1271.  move.w d0,ocl
  1272.  swap d0
  1273.  move.w d0,och
  1274.  
  1275.  bset.b #1,$bfe001
  1276.  
  1277. ; jmp stuff
  1278. ;endstuff:
  1279.  
  1280.  move.w #$00ff,$dff09e
  1281.  
  1282. ; move.l #Blurbfield,$dff080
  1283.  
  1284.  move.w #0,d0
  1285.  
  1286.  move.l scrn,d0
  1287.  move.w d0,pl1l
  1288.  swap d0
  1289.  move.w d0,pl1h
  1290.  
  1291.  swap d0
  1292.  add.l #10240,d0
  1293.  move.w d0,pl2l
  1294.  swap d0
  1295.  move.w d0,pl2h
  1296.  
  1297.  swap d0
  1298.  add.l #10240,d0
  1299.  move.w d0,pl3l
  1300.  swap d0
  1301.  move.w d0,pl3h
  1302.  
  1303.  swap d0
  1304.  add.l #10240,d0
  1305.  move.w d0,pl4l
  1306.  swap d0
  1307.  move.w d0,pl4h
  1308.  
  1309.  swap d0
  1310.  add.l #10240,d0
  1311.  move.w d0,pl5l
  1312.  swap d0
  1313.  move.w d0,pl5h
  1314.  
  1315.  swap d0
  1316.  add.l #10240,d0
  1317.  move.w d0,pl6l
  1318.  swap d0
  1319.  move.w d0,pl6h
  1320.  
  1321.  swap d0
  1322.  add.l #10240,d0
  1323.  move.w d0,pl7l
  1324.  swap d0
  1325.  move.w d0,pl7h
  1326.  
  1327.  swap d0
  1328.  add.l #10240,d0
  1329.  move.w d0,pl8l
  1330.  swap d0
  1331.  move.w d0,pl8h
  1332.  
  1333.  
  1334. ****************************
  1335.  jsr INITPLAYER
  1336. ; bsr initobjpos
  1337. ****************************
  1338.  
  1339.  
  1340.  move.l #$dff000,a6
  1341.  
  1342.  move.l #null,$dff0a0
  1343.  move.w #100,$dff0a4
  1344.  move.w #443,$dff0a6
  1345.  move.w #63,$dff0a8
  1346.  
  1347.  move.l #null2,$dff0b0
  1348.  move.w #100,$dff0b4
  1349.  move.w #443,$dff0b6
  1350.  move.w #63,$dff0b8
  1351.  
  1352.  move.l #null4,$dff0c0
  1353.  move.w #100,$dff0c4
  1354.  move.w #443,$dff0c6
  1355.  move.w #63,$dff0c8
  1356.  
  1357.  move.l #null3,$dff0d0
  1358.  move.w #100,$dff0d4
  1359.  move.w #443,$dff0d6
  1360.  move.w #63,$dff0d8
  1361.  
  1362.  ifeq CHEESEY
  1363.  
  1364.  move.l #tab,a1
  1365.  move.w #64,d7
  1366.  move.w #0,d6
  1367. outerlop
  1368.  move.l #pretab,a0
  1369.  move.w #255,d5
  1370. scaledownlop:
  1371.  move.b (a0)+,d0
  1372.  ext.w d0
  1373.  ext.l d0
  1374.  muls d6,d0
  1375.  asr.l #6,d0
  1376.  move.b d0,(a1)+
  1377.  dbra d5,scaledownlop
  1378.  addq #1,d6
  1379.  dbra d7,outerlop
  1380.  
  1381.  endc
  1382.  
  1383.  move.l #$dff000,a6
  1384.  
  1385.  move.w #$c008,intena(a6)
  1386.  
  1387.  move.w #$f,dmacon(a6)
  1388.  move.w #$820f,dmacon(a6)
  1389.  
  1390. ; bsr protinit
  1391.  
  1392.  
  1393. ; move.w #$20,$1dc(a6)
  1394.  
  1395.  move.w #$0,$dff034
  1396.  move.w #0,Conditions
  1397.  
  1398.  cmp.b #'n',mors
  1399.  beq.s .nokeys
  1400.  move.w #%111111111111,Conditions
  1401. .nokeys:
  1402.  
  1403.  move.l #KeyMap,a5
  1404.  clr.b $45(a5)
  1405.  
  1406.  move.l LEVELMUSIC,mt_data
  1407.  clr.b UseAllChannels
  1408.  
  1409. ; cmp.b #'b',Prefsfile+3
  1410. ; bne.s .noback
  1411.  
  1412. *********************************
  1413.  
  1414.  st CHANNELDATA
  1415.  jsr mt_init
  1416.  
  1417. *********************************
  1418.  
  1419.  
  1420. ;.noback:
  1421.  
  1422.  
  1423. ;
  1424. ; clr.b CHANNELDATA
  1425. ; clr.b CHANNELDATA+8
  1426. ; clr.b CHANNELDATA+16
  1427. ; clr.b CHANNELDATA+24
  1428. ;
  1429. ; cmp.b #'b',Prefsfile+3
  1430. ; bne.s noreserve
  1431. ;
  1432.  st CHANNELDATA
  1433.  st CHANNELDATA+8
  1434. ; st CHANNELDATA+16
  1435. ; st CHANNELDATA+24
  1436. ;noreserve: 
  1437.  
  1438. ; st CHANNELDATA
  1439. ; st CHANNELDATA+8
  1440.  
  1441.  move.l SampleList+6*8,pos0LEFT
  1442.  move.l SampleList+6*8+4,Samp0endLEFT
  1443.  move.l #playerheight,PLR1s_targheight
  1444.  move.l #playerheight,PLR1s_height
  1445.  move.l #playerheight,PLR2s_targheight
  1446.  move.l #playerheight,PLR2s_height
  1447.  
  1448. ; cmp.b #'n',mors
  1449. ; beq.s nohandshake
  1450. ;
  1451. ; move.b #%11011000,$bfd200
  1452. ; move.b #%00010000,$bfd000
  1453. ;waitloop:
  1454. ; btst.b #4,$bfd000
  1455. ; bne.s waitloop
  1456. ; move.b #%11000000,$bfd200
  1457.  
  1458. ;wtmouse:
  1459. ; btst #6,$bfe001
  1460. ; bne.s wtmouse
  1461.  
  1462. ;nohandshake:
  1463.  
  1464. ; jmp end
  1465.  
  1466. ; move.l COPSCRN1,drawpt
  1467. ; move.l COPSCRN2,olddrawpt
  1468.  
  1469.  jsr CLEARKEYBOARD
  1470. ; jsr MAKEBACKROUT
  1471.  
  1472.  clr.b MASTERQUITTING
  1473.  
  1474.  cmp.b #'n',mors
  1475.  seq SLAVEQUITTING
  1476.  
  1477. ; move.w #200,PLAYERTWOHEALTH
  1478. ; move.w #200,PLAYERONEHEALTH
  1479.  
  1480. ; move.l #ANOTHERSUP,$80
  1481. ; trap #0
  1482. ; rts
  1483. ;
  1484. ;ANOTHERSUP:
  1485.  
  1486.  move.l $4.w,a6
  1487.  jsr _LVOSuperState(a6)
  1488.  move.l d0,SSTACK
  1489.  
  1490.  CACHE_FREEZE_OFF d2
  1491.  
  1492. ; charlie
  1493. ; DATA_CACHE_ON d2
  1494.  
  1495.  DataCacheOn
  1496.  
  1497.  move.l $4.w,a6
  1498.  move.l SSTACK,d0
  1499.  jsr _LVOUserState(a6)
  1500.  
  1501.  move.l #0,hitcol
  1502.  
  1503.  cmp.b #'n',mors
  1504.  bne.s NOCLTXT
  1505.  
  1506.  move.b #0,lastpressed
  1507. .wtpress
  1508.  btst #6,$bfe001
  1509.  beq.s CLOSETXT
  1510.  btst #7,$bfe001
  1511.  beq.s CLOSETXT
  1512.  tst.b lastpressed
  1513.  beq.s .wtpress
  1514.  
  1515. CLOSETXT:
  1516.  
  1517.  move.w #$8f8,d0
  1518.  move.w #7,d1
  1519.  
  1520. .fdup
  1521.  move.w d0,TXTCOLL
  1522.  move.w d0,MIXCOLL
  1523.  sub.w #$121,d0
  1524. .wtframe:
  1525.  btst #5,$dff000+intreqrl
  1526.  beq.s .wtframe
  1527.  move.w #$0020,$dff000+intreq
  1528.  dbra d1,.fdup
  1529.  
  1530.  move.w #0,TXTCOLL
  1531.  move.w #0,MIXCOLL
  1532.  
  1533. NOCLTXT:
  1534.  
  1535.  
  1536.  
  1537.     move.l    4.w,a6
  1538.     jsr    _LVOForbid(a6)
  1539. ;    jsr    _LVODisable(a6)
  1540.  
  1541.  
  1542. ;    move.w    #%0111111111111111,intena+$dff000
  1543. ;    move.w    #%1000000011111111,intena+$dff000
  1544.  
  1545.  
  1546. ;charlie 
  1547.  move.l #PALETTEBIT,$dff084
  1548.  move.l #bigfield,$dff080    ; Point the copper at our copperlist.
  1549.  
  1550.  
  1551.  clr.b PLR1_Ducked
  1552.  clr.b PLR2_Ducked
  1553.  clr.b p1_ducked
  1554.  clr.b p2_ducked
  1555.  
  1556. ********************************************
  1557.  
  1558. ;    jmp docredits
  1559.  
  1560. ********************************************
  1561.  
  1562.  
  1563.  st doanything
  1564.  st dosounds
  1565.  
  1566.  jsr CLRNASTYMEM
  1567.  
  1568.  move.l #COMPACTMAP,a0
  1569.  move.l a0,LASTZONE
  1570.  move.w #255,d0
  1571. .clrmap
  1572.  move.l #0,(a0)+
  1573.  dbra d0,.clrmap
  1574.  
  1575.  move.l #COMPACTMAP,a0
  1576.  move.l #BIGMAP,a1
  1577.  
  1578.  bra NOALLWALLS
  1579.  
  1580.  move.l ZoneGraphAdds,a2
  1581. DOALLWALLS:
  1582.  move.l (a2),d0
  1583.  beq.s nomorezones
  1584.  move.l d0,a3
  1585.  
  1586.  addq #8,a2
  1587.  
  1588.  add.l LEVELGRAPHICS,a3
  1589.  addq #2,a3
  1590.  move.l a1,a4
  1591.  
  1592. ; DOLOWERROOM
  1593.  
  1594. innerwalls:
  1595.  move.b (a3),d1
  1596.  move.b 1(a3),d0
  1597.  bne doneinner
  1598.  
  1599.  tst.b d1
  1600.  blt noid
  1601.  
  1602.  move.b d1,d3
  1603.  and.w #15,d1
  1604.  
  1605.  moveq #0,d0
  1606.  move.w d1,d2
  1607.  add.w d1,d1
  1608.  add.w d2,d1
  1609.  addq #1,d1
  1610.  bset d1,d0
  1611.  btst #4,d3
  1612.  beq.s .nodoor
  1613.  addq #1,d1
  1614.  bset d1,d0
  1615. .nodoor
  1616.  
  1617.  or.l d0,(a0)
  1618.  
  1619.  move.w 2(a3),(a4)
  1620.  move.w 4(a3),2(a4)
  1621.  
  1622. noid:
  1623.  
  1624.  add.w #30,a3
  1625.  addq #4,a4
  1626.  
  1627.  bra innerwalls
  1628.  
  1629. doneinner:
  1630.  
  1631.  add.w #40,a1
  1632.  addq #4,a0
  1633.  
  1634.  bra DOALLWALLS
  1635. nomorezones:
  1636.  
  1637. NOALLWALLS
  1638.  
  1639.  move.w #96,MIDDLEX
  1640.  move.w #192,RIGHTX
  1641.  move.w #160,BOTTOMY
  1642.  move.w #80,TOTHEMIDDLE
  1643.  clr.b FULLSCR
  1644.  move.l scrn,a0
  1645.  jsr WIPEDISPLAY
  1646.  move.l scrn2,a0
  1647.  jsr WIPEDISPLAY
  1648.  
  1649.  st PLAYERONEGUNS+1
  1650.  st PLAYERTWOGUNS+1
  1651.  st PLAYERTHREEGUNS+1
  1652.  
  1653.  move.w #100,timetodamage
  1654.  
  1655.  move.w #299,d0
  1656.  move.l #DAMAGED,a0
  1657. CLRDAM:
  1658.  move.w #0,(a0)+
  1659.  dbra d0,CLRDAM
  1660.  
  1661.  moveq #0,d0
  1662.  move.w d0,STOPOFFSET
  1663.  neg.w d0
  1664.  add.w TOTHEMIDDLE,d0
  1665.  move.w d0,SMIDDLEY
  1666.  muls #320,d0
  1667.  move.l d0,SBIGMIDDLEY
  1668.  
  1669.  move.w #0,PLR1_AIMSPD
  1670.  move.w #0,PLR2_AIMSPD
  1671.  move.w #0,PLR3_AIMSPD
  1672.  
  1673.  move.l scrn,SCRNSHOWPT
  1674.  
  1675.  move.l scrn2,SCRNDRAWPT
  1676.  
  1677.  
  1678.  
  1679.  move.l #MESSAGEBUFFER,a0
  1680.  move.w #19,d0
  1681. clrmessbuff:
  1682.  move.l #0,(a0)+
  1683.  dbra d0,clrmessbuff
  1684.  
  1685.  move.l #nullmessage,d0
  1686.  jsr SENDMESSAGE
  1687.  
  1688.  clr.b PLR2_fire
  1689.  clr.b p2_fire
  1690.  clr.b PLR2_SPCTAP
  1691.  clr.b p2_spctap
  1692.  
  1693.  clr.b PLR1_dead
  1694.  clr.b PLR2_dead
  1695.  clr.b PLR3_dead
  1696.  
  1697.  move.l PLR1_Obj,a0
  1698.  move.l PLR2_Obj,a1
  1699.  move.l PLR3_Obj,a2
  1700.  move.w #0,ImpactX(a0)
  1701.  move.w #0,ImpactY(a0)
  1702.  move.w #0,ImpactZ(a0)
  1703.  move.w #0,ImpactX(a1)
  1704.  move.w #0,ImpactY(a1)
  1705.  move.w #0,ImpactZ(a1)
  1706.  move.w #0,ImpactX(a2)
  1707.  move.w #0,ImpactY(a2)
  1708.  move.w #0,ImpactZ(a2)
  1709.  
  1710.  move.l #0,PLR1s_xspdval
  1711.  move.l #0,PLR1s_zspdval
  1712.  move.l #0,PLR1s_yvel
  1713.  move.l #0,PLR2s_xspdval
  1714.  move.l #0,PLR2s_zspdval
  1715.  move.l #0,PLR2s_yvel
  1716.  move.l #0,PLR3s_xspdval
  1717.  move.l #0,PLR3s_zspdval
  1718.  move.l #0,PLR3s_yvel
  1719.  move.l #0,PLR1_xspdval
  1720.  move.l #0,PLR1_zspdval
  1721.  move.l #0,PLR1_yvel
  1722.  move.l #0,PLR2_xspdval
  1723.  move.l #0,PLR2_zspdval
  1724.  move.l #0,PLR2_yvel
  1725.  move.l #0,PLR3_xspdval
  1726.  move.l #0,PLR3_zspdval
  1727.  move.l #0,PLR3_yvel
  1728.  
  1729.  
  1730. lop:
  1731.  move.w #%110000000000,$dff034
  1732.  
  1733.  
  1734. **********************************
  1735.  cmp.b #'1',WHICHAMI
  1736.  beq .notmess
  1737.  tst.b PLR1_dead
  1738.  bne .notmess
  1739.  
  1740.  tst.w PLAYERONEHEALTH
  1741.  bgt .notmess
  1742.  
  1743.  st PLR1_dead
  1744.  
  1745.  move.w #0,d0
  1746.  add.l #IVEWONTEXT,d0
  1747.  jsr SENDMESSAGE
  1748.  
  1749.  move.l PLR1_Obj,a0
  1750.  
  1751.  move.l LINKFILE,a6
  1752.  add.l #PLR1ALIEN,a6
  1753.  move.w (a6),d7
  1754.  move.w d7,d1
  1755.  move.l LINKFILE,a6
  1756.  add.l #AlienStats,a6
  1757.  muls #AlienStatLen,d1
  1758.  add.l d1,a6
  1759.  
  1760.  move.b A_TypeOfSplat+1(a6),d0
  1761.  move.b d0,TypeOfSplat
  1762.  
  1763.  move.l PLR1_Roompt,a1
  1764.  move.w (a1),12(a0)
  1765.  move.w p1_xoff,newx
  1766.  move.w p1_zoff,newz
  1767.  move.w #7,d2
  1768.  jsr ExplodeIntoBits
  1769.  move.w #-1,12(a0)
  1770.  
  1771. .notmess:
  1772.  
  1773. **********************************
  1774.  cmp.b #'2',WHICHAMI
  1775.  beq .notmess2
  1776.  tst.b PLR2_dead
  1777.  bne .notmess2
  1778.  
  1779.  tst.w PLAYERTWOHEALTH
  1780.  bgt .notmess2
  1781.  
  1782.  st PLR2_dead
  1783.  
  1784.  move.w #160,d0
  1785.  add.l #IVEWONTEXT,d0
  1786.  jsr SENDMESSAGE
  1787.  
  1788.  move.l PLR2_Obj,a0
  1789.  
  1790.  move.l LINKFILE,a6
  1791.  add.l #PLR2ALIEN,a6
  1792.  move.w (a6),d7
  1793.  move.w d7,d1
  1794.  move.l LINKFILE,a6
  1795.  add.l #AlienStats,a6
  1796.  muls #AlienStatLen,d1
  1797.  add.l d1,a6
  1798.  
  1799.  move.b A_TypeOfSplat+1(a6),d0
  1800.  move.b d0,TypeOfSplat
  1801.  
  1802.  move.l PLR2_Roompt,a1
  1803.  move.w (a1),12(a0)
  1804.  move.w p2_xoff,newx
  1805.  move.w p2_zoff,newz
  1806.  move.w #7,d2
  1807.  jsr ExplodeIntoBits
  1808.  move.w #-1,12(a0)
  1809.  
  1810. .notmess2:
  1811. **********************************
  1812.  cmp.b #'3',WHICHAMI
  1813.  beq .notmess3
  1814.  tst.b PLR3_dead
  1815.  bne .notmess3
  1816.  
  1817.  tst.w PLAYERTHREEHEALTH
  1818.  bgt .notmess3
  1819.  
  1820.  st PLR3_dead
  1821.  
  1822.  move.w #320,d0
  1823.  add.l #IVEWONTEXT,d0
  1824.  jsr SENDMESSAGE
  1825.  
  1826.  move.l PLR3_Obj,a0
  1827.  
  1828.  move.l LINKFILE,a6
  1829.  add.l #PLR1ALIEN,a6
  1830.  move.w (a6),d7
  1831.  move.w d7,d1
  1832.  move.l LINKFILE,a6
  1833.  add.l #AlienStats,a6
  1834.  muls #AlienStatLen,d1
  1835.  add.l d1,a6
  1836.  
  1837.  move.b A_TypeOfSplat+1(a6),d0
  1838.  move.b d0,TypeOfSplat
  1839.  
  1840.  move.l PLR3_Roompt,a1
  1841.  move.w (a1),12(a0)
  1842.  move.w p3_xoff,newx
  1843.  move.w p3_zoff,newz
  1844.  move.w #7,d2
  1845.  jsr ExplodeIntoBits
  1846.  move.w #-1,12(a0)
  1847.  
  1848. .notmess3:
  1849. ***********************************
  1850.  
  1851.  
  1852.  move.w #%110000000000,$dff034
  1853.  
  1854. ; move.w COUNTER,d0
  1855. ; ext.l d0
  1856. ; divs #10,d0
  1857. ; swap d0
  1858. ; add.b #'0',d0
  1859. ; move.b d0,COUNTSPACE+2
  1860. ; swap d0
  1861. ; ext.l d0
  1862. ; divs #10,d0
  1863. ; swap d0
  1864. ; add.b #'0',d0
  1865. ; move.b d0,COUNTSPACE+1
  1866. ; swap d0
  1867. ; add.b #'0',d0
  1868. ; move.b d0,COUNTSPACE
  1869. ;
  1870. ; move.w COUNTER2,d0
  1871. ; ext.l d0
  1872. ; divs #10,d0
  1873. ; swap d0
  1874. ; add.b #'0',d0
  1875. ; move.b d0,COUNTSPACE+5
  1876. ; swap d0
  1877. ; ext.l d0
  1878. ; divs #10,d0
  1879. ; swap d0
  1880. ; add.b #'0',d0
  1881. ; move.b d0,COUNTSPACE+4
  1882. ; swap d0
  1883. ; add.b #'0',d0
  1884. ; move.b d0,COUNTSPACE+3
  1885.  
  1886. ;
  1887. ; move.l #COUNTSPACE,d0
  1888. ; jsr SENDMESSAGE
  1889. ;
  1890. ; move.w #0,COUNTER
  1891. ; move.w #0,COUNTER2
  1892.  
  1893.  move.b MAPON,REALMAPON
  1894.  
  1895.  move.b FULLSCRTEMP,d0
  1896.  move.b FULLSCR,d1
  1897.  eor.b d1,d0
  1898.  beq .notswapscr2
  1899.  
  1900.  move.b FULLSCRTEMP,FULLSCR
  1901.  beq.s .notswapscr3
  1902.  
  1903.  cmp.w #100,WIDESCRN
  1904.  blt.s .okwidee
  1905.  move.w #100,WIDESCRN
  1906. .okwidee:
  1907.  
  1908.  move.w #144,MIDDLEX
  1909.  move.w #288,RIGHTX
  1910.  move.w #232,BOTTOMY
  1911.  move.w #120,TOTHEMIDDLE
  1912.  move.l SCRNSHOWPT,a0
  1913.  jsr WIPEDISPLAY
  1914.  move.l SCRNDRAWPT,a0
  1915.  jsr WIPEDISPLAY
  1916.  
  1917.  bra.s .notswapscr2
  1918.  
  1919. .notswapscr3:
  1920.  cmp.w #60,WIDESCRN
  1921.  blt.s .okwide
  1922.  move.w #60,WIDESCRN
  1923. .okwide:
  1924.  
  1925.  
  1926.  move.w #96,MIDDLEX
  1927.  move.w #192,RIGHTX
  1928.  move.w #160,BOTTOMY
  1929.  move.w #80,TOTHEMIDDLE
  1930.  move.l SCRNSHOWPT,a0
  1931.  jsr WIPEDISPLAY
  1932.  move.l SCRNDRAWPT,a0
  1933.  jsr WIPEDISPLAY
  1934. .notswapscr2:
  1935.  
  1936.  
  1937.  btst #6,$bfe001
  1938. ;charlie bne.b .nocop
  1939.  
  1940. ;charlie move.l #bigfield,$dff080    ; Point the copper at our copperlist.
  1941.  
  1942. .nocop
  1943.  
  1944.  move.l #KeyMap,a5
  1945.  
  1946.  cmp.b #'n',mors
  1947.  bne .nopause
  1948.  tst.b $19(a5)
  1949.  beq.s .nopause
  1950.  clr.b doanything
  1951.  
  1952. .waitrel:
  1953.  
  1954.  tst.b PLR1JOY
  1955.  beq.s .NOJOY
  1956.  jsr _ReadJoy1
  1957. .NOJOY
  1958.  
  1959.  tst.b $19(a5)
  1960.  bne.s .waitrel
  1961.  
  1962.  bsr PAUSEOPTS
  1963.  
  1964.  st doanything
  1965. .nopause: 
  1966.  
  1967.  move.l hitcol,d0
  1968.  move.l d0,d1
  1969.  
  1970. ********************************************
  1971. * Remove after colour testing 
  1972. ; moveq #0,d1
  1973. ********************************************
  1974.  
  1975.  add.l #PALETTEBIT,d1
  1976.  tst.l d0
  1977.  beq.s nofadedownhc
  1978.  sub.l #2116,d0
  1979.  move.l d0,hitcol
  1980. nofadedownhc:
  1981.  
  1982.  move.l d1,a0
  1983.  move.l #PALETTESPACE,a1
  1984.  move.l #(2116/4)-2,d0
  1985. putinpal:
  1986.  move.l (a0)+,(a1)+
  1987.  dbra d0,putinpal
  1988.  
  1989.  st READCONTROLS
  1990.  move.l #$dff000,a6
  1991.  
  1992.  
  1993.  cmp.b #'n',mors
  1994.  beq .nopause
  1995.  
  1996.  move.b PLR1_PAUSE,d0
  1997.  or.b PLR2_PAUSE,d0
  1998.  or.b PLR3_PAUSE,d0
  1999.  beq .nopause
  2000.  clr.b doanything
  2001.  
  2002.  move.l #KeyMap,a5
  2003. .waitrel:
  2004.  
  2005.  cmp.b #'s',mors
  2006.  beq.s .RE2
  2007.  tst.b PLR1JOY
  2008.  beq.s .NOJOY
  2009.  jsr _ReadJoy1
  2010.  bra .RE1
  2011. .RE2:
  2012.  tst.b PLR2JOY
  2013.  beq.s .NOJOY
  2014.  jsr _ReadJoy2
  2015. .RE1
  2016. .NOJOY:
  2017.  tst.b $19(a5)
  2018.  bne.s .waitrel
  2019.  
  2020.  bsr PAUSEOPTS
  2021.  
  2022.  cmp.b #'2',WHICHAMI
  2023.  blt.s .p1unp
  2024.  beq.s .p2unp
  2025.  bra.s .p3unp
  2026.  
  2027. .p1unp:
  2028.  jsr SENDFIRST
  2029.  jsr SENDFIRST
  2030.  clr.b PLR1_PAUSE
  2031.  clr.b PLR2_PAUSE
  2032.  clr.b PLR3_PAUSE
  2033.  st doanything
  2034.  bra.s .nopause
  2035.  
  2036. .p2unp:
  2037.  jsr RECFIRST
  2038.  jsr SENDPAR
  2039.  jsr RECFIRST
  2040.  clr.b PLR1_PAUSE
  2041.  clr.b PLR2_PAUSE
  2042.  clr.b PLR3_PAUSE
  2043.  st doanything
  2044.  bra.s .nopause
  2045.  
  2046. .p3unp:
  2047.  jsr RECPAR
  2048.  clr.b PLR1_PAUSE
  2049.  clr.b PLR2_PAUSE
  2050.  clr.b PLR3_PAUSE
  2051.  st doanything 
  2052.  
  2053. ; cmp.b #'m',mors
  2054. ; bne.s .slavelast
  2055. ; Jsr SENDFIRST
  2056. ; bra .masfirst
  2057. ;.slavelast
  2058. ; Jsr RECFIRST
  2059. ;.masfirst:
  2060. ; clr.b SLAVEPAUSE
  2061. ; clr.b MASTERPAUSE
  2062. ; st doanything
  2063.  
  2064. .nopause: 
  2065.  
  2066.  
  2067.  move.l drawpt,d0
  2068.  move.l olddrawpt,drawpt
  2069.  move.l d0,olddrawpt
  2070.  
  2071.  move.l SCRNDRAWPT,d0
  2072.  move.l SCRNSHOWPT,SCRNDRAWPT
  2073.  move.l d0,SCRNSHOWPT
  2074.  
  2075. ; move.l d0,$dff084    
  2076.  move.l drawpt,a3
  2077. ; move.l COPSCRNBUFF,a3
  2078.  adda.w #10,a3
  2079.  move.l a3,frompt
  2080.  add.l #104*4*40,a3
  2081.  move.l a3,midpt
  2082.  
  2083.  cmp.b #'1',WHICHAMI
  2084.  bne.s nowaitslave
  2085.  
  2086. waitfortop:
  2087.  
  2088.  btst.b #0,intreqrl(a6)
  2089.  beq.b waitfortop
  2090.  
  2091.  move.w #$1,intreq(a6)
  2092. ; move.l #PLR1_GunData,GunData
  2093.  move.b PLR1_GunSelected,GunSelected
  2094.  bra waitmaster
  2095.  
  2096. nowaitslave:
  2097.  cmp.b #'2',WHICHAMI
  2098.  bne.s .noplr2
  2099.  
  2100.  move.b PLR2_GunSelected,GunSelected
  2101.  bra waitmaster
  2102.  
  2103. .noplr2:
  2104.  
  2105. ; move.l #PLR2_GunData,GunData
  2106.  move.b PLR3_GunSelected,GunSelected
  2107. waitmaster:
  2108.  
  2109.  move.l d0,d1
  2110.  move.l d1,d0
  2111.  move.w d0,pl1l
  2112.  swap d0
  2113.  move.w d0,pl1h
  2114.  
  2115.  add.l #10240,d1
  2116.  move.l d1,d0
  2117.  move.w d0,pl2l
  2118.  swap d0
  2119.  move.w d0,pl2h
  2120.  
  2121.  add.l #10240,d1
  2122.  move.l d1,d0
  2123.  move.w d0,pl3l
  2124.  swap d0
  2125.  move.w d0,pl3h
  2126.  
  2127.  add.l #10240,d1
  2128.  move.l d1,d0
  2129.  move.w d0,pl4l
  2130.  swap d0
  2131.  move.w d0,pl4h
  2132.  
  2133.  add.l #10240,d1
  2134.  move.l d1,d0
  2135.  move.w d0,pl5l
  2136.  swap d0
  2137.  move.w d0,pl5h
  2138.  
  2139.  add.l #10240,d1
  2140.  move.l d1,d0
  2141.  move.w d0,pl6l
  2142.  swap d0
  2143.  move.w d0,pl6h
  2144.  
  2145.  add.l #10240,d1
  2146.  move.l d1,d0
  2147.  move.w d0,pl7l
  2148.  swap d0
  2149.  move.w d0,pl7h
  2150.  
  2151.  add.l #10240,d1
  2152.  move.l d1,d0
  2153.  move.w d0,pl8l
  2154.  swap d0
  2155.  move.w d0,pl8h 
  2156.  
  2157.  move.l #SMIDDLEY,a0
  2158.  movem.l (a0)+,d0/d1
  2159.  move.l d0,MIDDLEY
  2160.  move.l d1,MIDDLEY+4
  2161.  
  2162.  move.l waterpt,a0
  2163.  move.l (a0)+,watertouse
  2164.  cmp.l #endwaterlist,a0
  2165.  blt.s okwat
  2166.  move.l #waterlist,a0
  2167. okwat:
  2168.  move.l a0,waterpt
  2169.  
  2170.  add.w #640,wtan
  2171.  and.w #8191,wtan
  2172.  add.l #1,wateroff
  2173.  and.l #$3fff3fff,wateroff
  2174.  
  2175.  move.l PLR1_xoff,OLDX1
  2176.  move.l PLR1_zoff,OLDZ1
  2177.  move.l PLR2_xoff,OLDX2
  2178.  move.l PLR2_zoff,OLDZ2
  2179.  move.l PLR3_xoff,OLDX3
  2180.  move.l PLR3_zoff,OLDZ3
  2181.  
  2182.  move.l #$dff000,a6
  2183.  
  2184. ; cmp.b #'s',mors
  2185. ; beq ASlaveShouldWaitOnHisMaster
  2186. ;
  2187. ; cmp.b #'n',mors
  2188. ; bne NotOnePlayer
  2189. ;
  2190. ; movem.l d0-d7/a0-a6,-(a7)
  2191. ;
  2192. ; moveq #0,d0
  2193. ; move.b GunSelected,d0
  2194. ; move.l LINKFILE,a6
  2195. ; add.l #GunBulletTypes,a6
  2196. ; move.w (a6,d0.w*8),d0
  2197. ; move.l #PLAYERONEAMMO,a6
  2198. ; move.w (a6,d0.w*2),d0
  2199. ; move.w d0,Ammo
  2200. ; movem.l (a7)+,d0-d7/a0-a6
  2201. ; move.w PLAYERONEHEALTH,Energy
  2202. ; move.w FramesToDraw,TempFrames
  2203. ; cmp.w #15,TempFrames
  2204. ; blt.s .okframe
  2205. ; move.w #15,TempFrames
  2206. ;.okframe:
  2207. ; move.w #0,FramesToDraw
  2208. ;
  2209. ;*********************************************
  2210. ;*********** TAKE THIS OUT *******************
  2211. ;*********************************************
  2212. ;
  2213. ; move.l CHEATPTR,a4
  2214. ; add.l #200000,a4
  2215. ; moveq #0,d0
  2216. ; move.b (a4),d0
  2217. ;
  2218. ; move.l #KeyMap,a5
  2219. ; tst.b (a5,d0.w)
  2220. ; beq.s .nocheat
  2221. ; addq #1,a4
  2222. ; cmp.l #ENDCHEAT,a4
  2223. ; blt.s .nocheat
  2224. ; cmp.w #0,CHEATNUM
  2225. ; beq.s .nocheat
  2226. ; sub.w #1,CHEATNUM
  2227. ; move.l #CHEATFRAME,a4
  2228. ; move.w #127,PLR1_energy
  2229. ; jsr EnergyBar
  2230. ;.nocheat
  2231. ;
  2232. ; sub.l #200000,a4
  2233. ; move.l a4,CHEATPTR
  2234. ;
  2235. ;**********************************************
  2236. ;**********************************************
  2237. ;**********************************************
  2238.  
  2239. ; move.l PLR1s_xoff,p1_xoff
  2240. ; move.l PLR1s_zoff,p1_zoff
  2241. ; move.l PLR1s_yoff,p1_yoff
  2242. ; move.l PLR1s_height,p1_height
  2243. ; move.w PLR1s_angpos,p1_angpos
  2244. ; move.w PLR1_bobble,p1_bobble
  2245. ; move.b PLR1_clicked,p1_clicked
  2246. ; move.b PLR1_fire,p1_fire
  2247. ; clr.b PLR1_clicked
  2248. ; move.b PLR1_SPCTAP,p1_spctap
  2249. ; clr.b PLR1_SPCTAP
  2250. ; move.b PLR1_Ducked,p1_ducked
  2251. ; move.b PLR1_GunSelected,p1_gunselected
  2252. ;
  2253. ; bsr PLR1_Control
  2254. ;
  2255. ; move.l PLR1_Roompt,a0
  2256. ; move.l ToZoneRoof(a0),SplitHeight
  2257. ; move.w p1_xoff,THISPLRxoff
  2258. ; move.w p1_zoff,THISPLRzoff
  2259. ; move.l #$60000,p2_yoff
  2260. ; move.l PLR2_Obj,a0
  2261. ; move.w #-1,GraphicRoom(a0)
  2262. ; move.w #-1,12(a0)
  2263. ; move.b #0,17(a0)
  2264. ; move.l #BollocksRoom,PLR2_Roompt
  2265. ; bra donetalking
  2266.  
  2267.  
  2268.  cmp.b #'2',WHICHAMI
  2269.  blt PLR1stuff
  2270.  beq PLR2stuff
  2271.  bra PLR2stuff
  2272.  
  2273. PLR1stuff
  2274.  move.l #KeyMap,a5
  2275.  tst.b $19(a5)
  2276.  sne PLR1_PAUSE
  2277.  movem.l d0-d7/a0-a6,-(a7)
  2278.  moveq #0,d0
  2279.  move.b GunSelected,d0
  2280.  move.l LINKFILE,a6
  2281.  add.l #GunBulletTypes,a6
  2282.  move.w (a6,d0.w*8),d0
  2283.  
  2284.  move.l #PLAYERONEAMMO,a6
  2285.  move.w (a6,d0.w*2),d0
  2286.  move.w d0,Ammo
  2287.  movem.l (a7)+,d0-d7/a0-a6
  2288.  
  2289.  jsr SENDFIRST
  2290.  move.w FramesToDraw,TempFrames
  2291.  cmp.w #15,TempFrames
  2292.  blt.s .okframe
  2293.  move.w #15,TempFrames
  2294. .okframe:
  2295.  move.w #0,FramesToDraw
  2296.  
  2297.  move.l PLR1s_xoff,p1_xoff
  2298.  move.l PLR1s_zoff,p1_zoff
  2299.  move.l PLR1s_yoff,p1_yoff
  2300.  move.l PLR1s_height,p1_height
  2301.  move.w PLR1s_angpos,p1_angpos
  2302.  move.w PLR1_bobble,p1_bobble
  2303.  move.b PLR1_clicked,p1_clicked
  2304.  clr.b PLR1_clicked
  2305.  move.b PLR1_fire,p1_fire
  2306.  move.b PLR1_SPCTAP,p1_spctap
  2307.  clr.b PLR1_SPCTAP
  2308.  move.b PLR1_Ducked,p1_ducked
  2309.  move.b PLR1_GunSelected,p1_gunselected
  2310.  
  2311.  move.l PLR1_AIMSPD,d0
  2312.  jsr SENDFIRST
  2313.  move.l d0,PLR2_AIMSPD
  2314.  
  2315.  move.l p1_xoff,d0
  2316.  jsr SENDFIRST
  2317.  move.l d0,p2_xoff
  2318.  
  2319.  move.l p1_zoff,d0
  2320.  jsr SENDFIRST
  2321.  move.l d0,p2_zoff 
  2322.  
  2323.  move.l p1_yoff,d0
  2324.  jsr SENDFIRST
  2325.  move.l d0,p2_yoff
  2326.   
  2327.  move.l p1_height,d0
  2328.  jsr SENDFIRST
  2329.  move.l d0,p2_height
  2330.  
  2331.  move.w p1_angpos,d0
  2332.  swap d0
  2333.  move.w p1_bobble,d0
  2334.  jsr SENDFIRST
  2335.  move.w d0,p2_bobble
  2336.  swap d0
  2337.  move.w d0,p2_angpos
  2338.  
  2339.  
  2340.  move.w TempFrames,d0
  2341.  swap d0
  2342.  move.b p1_spctap,d0
  2343.  lsl.w #8,d0
  2344.  move.b p1_clicked,d0
  2345.  jsr SENDFIRST
  2346.  move.b d0,p2_clicked
  2347.  lsr.w #8,d0
  2348.  move.b d0,p2_spctap
  2349.  
  2350.  move.w Rand1,d0
  2351.  swap d0
  2352.  move.b p1_ducked,d0
  2353.  or.b PLR1_Squished,d0
  2354.  lsl.w #8,d0
  2355.  move.b p1_gunselected,d0
  2356.  jsr SENDFIRST
  2357.  move.b d0,p2_gunselected
  2358.  lsr.w #8,d0
  2359.  move.b d0,p2_ducked
  2360.  
  2361.  move.b p1_fire,d0
  2362.  lsl.w #8,d0
  2363.  move.b PLR1QUITTING,d0
  2364.  or.b d0,PLR2QUITTING
  2365.  or.b d0,PLR3QUITTING
  2366.  swap d0
  2367.  move.b PLR1_PAUSE,d0
  2368.  or.b d0,PLR2_PAUSE
  2369.  or.b d0,PLR3_PAUSE
  2370.  jsr SENDFIRST
  2371.  or.b d0,PLR1_PAUSE
  2372.  or.b d0,PLR2_PAUSE
  2373.  or.b d0,PLR3_PAUSE
  2374.  swap d0
  2375.  or.b d0,PLR1QUITTING
  2376.  or.b d0,PLR2QUITTING
  2377.  or.b d0,PLR3QUITTING
  2378.  lsr.w #8,d0
  2379.  move.b d0,p2_fire
  2380.  
  2381.  move.w PLAYERONEHEALTH,d0
  2382.  jsr SENDFIRST
  2383.  move.w d0,PLAYERTWOHEALTH
  2384.  
  2385.  **********************************
  2386.  
  2387. ; move.l PLR1_AIMSPD,d0
  2388.  jsr SENDFIRST
  2389.  move.l d0,PLR3_AIMSPD
  2390.  
  2391. ; move.l p1_xoff,d0
  2392.  jsr SENDFIRST
  2393.  move.l d0,p3_xoff
  2394.  
  2395. ; move.l p1_zoff,d0
  2396.  jsr SENDFIRST
  2397.  move.l d0,p3_zoff 
  2398.  
  2399. ; move.l p1_yoff,d0
  2400.  jsr SENDFIRST
  2401.  move.l d0,p3_yoff
  2402.   
  2403. ; move.l p1_height,d0
  2404.  jsr SENDFIRST
  2405.  move.l d0,p3_height
  2406.  
  2407. ; move.w p1_angpos,d0
  2408. ; swap d0
  2409. ; move.w p1_bobble,d0
  2410.  jsr SENDFIRST
  2411.  move.w d0,p3_bobble
  2412.  swap d0
  2413.  move.w d0,p3_angpos
  2414.  
  2415.  
  2416. ; move.w TempFrames,d0
  2417. ; swap d0
  2418. ; move.b p1_spctap,d0
  2419. ; lsl.w #8,d0
  2420. ; move.b p1_clicked,d0
  2421.  jsr SENDFIRST
  2422.  move.b d0,p3_clicked
  2423.  lsr.w #8,d0
  2424.  move.b d0,p3_spctap
  2425.  
  2426. ; move.w Rand1,d0
  2427. ; swap d0
  2428. ; move.b p1_ducked,d0
  2429. ; or.b PLR1_Squished,d0
  2430. ; lsl.w #8,d0
  2431. ; move.b p1_gunselected,d0
  2432.  jsr SENDFIRST
  2433.  move.b d0,p3_gunselected
  2434.  lsr.w #8,d0
  2435.  move.b d0,p3_ducked
  2436.  
  2437.  move.b p1_fire,d0
  2438.  lsl.w #8,d0
  2439.  move.b PLR1QUITTING,d0
  2440.  or.b d0,PLR2QUITTING
  2441.  or.b d0,PLR3QUITTING
  2442.  swap d0
  2443.  move.b PLR1_PAUSE,d0
  2444.  or.b d0,PLR2_PAUSE
  2445.  or.b d0,PLR3_PAUSE
  2446.  jsr SENDFIRST
  2447.  or.b d0,PLR1_PAUSE
  2448.  or.b d0,PLR2_PAUSE
  2449.  or.b d0,PLR3_PAUSE
  2450.  swap d0
  2451.  or.b d0,PLR1QUITTING
  2452.  or.b d0,PLR2QUITTING
  2453.  or.b d0,PLR3QUITTING
  2454.  lsr.w #8,d0
  2455.  move.b d0,p3_fire
  2456.  
  2457. ; move.w PLAYERONEHEALTH,d0
  2458.  jsr SENDFIRST
  2459.  move.w d0,PLAYERTHREEHEALTH
  2460.  
  2461.  bsr PLR1_Control
  2462.  bsr PLR2_Control
  2463.  bsr PLR3_Control
  2464.  move.l PLR1_Roompt,a0
  2465.  move.l ToZoneRoof(a0),SplitHeight
  2466.  move.w p1_xoff,THISPLRxoff
  2467.  move.w p1_zoff,THISPLRzoff
  2468.  
  2469.  bra donetalking
  2470.  
  2471. ;
  2472. ;
  2473. ;NotOnePlayer:
  2474. ; move.l #KeyMap,a5
  2475. ; tst.b $19(a5)
  2476. ; sne MASTERPAUSE
  2477. ;
  2478. ;*********************************
  2479. ; move.w PLAYERONEHEALTH,Energy
  2480. ; change this back
  2481. ;*********************************
  2482. ; movem.l d0-d7/a0-a6,-(a7)
  2483. ;
  2484. ; moveq #0,d0
  2485. ; move.b GunSelected,d0
  2486. ; move.l LINKFILE,a6
  2487. ; add.l #GunBulletTypes,a6
  2488. ; move.w (a6,d0.w*8),d0
  2489. ; move.l #PLAYERONEAMMO,a6
  2490. ; move.w (a6,d0.w*2),d0
  2491. ; move.w d0,Ammo
  2492. ; movem.l (a7)+,d0-d7/a0-a6
  2493. ;
  2494. ; jsr SENDFIRST
  2495. ;
  2496. ; move.w FramesToDraw,TempFrames
  2497. ; cmp.w #15,TempFrames
  2498. ; blt.s .okframe
  2499. ; move.w #15,TempFrames
  2500. ;.okframe:
  2501. ; move.w #0,FramesToDraw
  2502. ; move.l PLR1s_xoff,p1_xoff
  2503. ; move.l PLR1s_zoff,p1_zoff
  2504. ; move.l PLR1s_yoff,p1_yoff
  2505. ; move.l PLR1s_height,p1_height
  2506. ; move.w PLR1s_angpos,p1_angpos
  2507. ; move.w PLR1_bobble,p1_bobble
  2508. ; move.b PLR1_clicked,p1_clicked
  2509. ; clr.b PLR1_clicked
  2510. ; move.b PLR1_fire,p1_fire
  2511. ; move.b PLR1_SPCTAP,p1_spctap
  2512. ; clr.b PLR1_SPCTAP
  2513. ; move.b PLR1_Ducked,p1_ducked
  2514. ; move.b PLR1_GunSelected,p1_gunselected
  2515. ; move.l PLR1_AIMSPD,d0
  2516. ; jsr SENDFIRST
  2517. ; move.l d0,PLR2_AIMSPD
  2518. ; move.l p1_xoff,d0
  2519. ; jsr SENDFIRST
  2520. ; move.l d0,p2_xoff
  2521. ; move.l p1_zoff,d0
  2522. ; jsr SENDFIRST
  2523. ; move.l d0,p2_zoff 
  2524. ; move.l p1_yoff,d0
  2525. ; jsr SENDFIRST
  2526. ; move.l d0,p2_yoff
  2527. ;  
  2528. ; move.l p1_height,d0
  2529. ; jsr SENDFIRST
  2530. ; move.l d0,p2_height
  2531. ; move.w p1_angpos,d0
  2532. ; swap d0
  2533. ; move.w p1_bobble,d0
  2534. ; jsr SENDFIRST
  2535. ; move.w d0,p2_bobble
  2536. ; swap d0
  2537. ; move.w d0,p2_angpos
  2538. ; move.w TempFrames,d0
  2539. ; swap d0
  2540. ; move.b p1_spctap,d0
  2541. ; lsl.w #8,d0
  2542. ; move.b p1_clicked,d0
  2543. ; jsr SENDFIRST
  2544. ; move.b d0,p2_clicked
  2545. ; lsr.w #8,d0
  2546. ; move.b d0,p2_spctap
  2547. ; move.w Rand1,d0
  2548. ; swap d0
  2549. ; move.b p1_ducked,d0
  2550. ; or.b PLR1_Squished,d0
  2551. ; lsl.w #8,d0
  2552. ; move.b p1_gunselected,d0
  2553. ; jsr SENDFIRST
  2554. ; move.b d0,p2_gunselected
  2555. ; lsr.w #8,d0
  2556. ; move.b d0,p2_ducked
  2557. ; move.b p1_fire,d0
  2558. ; lsl.w #8,d0
  2559. ; move.b MASTERQUITTING,d0
  2560. ; or.b d0,SLAVEQUITTING
  2561. ; swap d0
  2562. ; move.b MASTERPAUSE,d0
  2563. ; or.b d0,SLAVEPAUSE
  2564. ; jsr SENDFIRST
  2565. ; or.b d0,MASTERPAUSE
  2566. ; or.b d0,SLAVEPAUSE
  2567. ; swap d0
  2568. ; or.b d0,SLAVEQUITTING
  2569. ; or.b d0,MASTERQUITTING
  2570. ; lsr.w #8,d0
  2571. ; move.b d0,p2_fire
  2572. ;
  2573. ; move.w PLAYERONEHEALTH,d0
  2574. ; jsr SENDFIRST
  2575. ; move.w d0,PLAYERTWOHEALTH
  2576. ; bsr PLR1_Control
  2577. ; bsr PLR2_Control
  2578. ; move.l PLR1_Roompt,a0
  2579. ; move.l ToZoneRoof(a0),SplitHeight
  2580. ; move.w p1_xoff,THISPLRxoff
  2581. ; move.w p1_zoff,THISPLRzoff
  2582. ; bra donetalking
  2583. ;
  2584. ;ASlaveShouldWaitOnHisMaster:
  2585.  
  2586. PLR2stuff:
  2587.  
  2588.  move.l #KeyMap,a5
  2589.  tst.b $19(a5)
  2590.  sne PLR2_PAUSE
  2591.  
  2592.  movem.l d0-d7/a0-a6,-(a7)
  2593.  
  2594.  moveq #0,d0
  2595.  move.b GunSelected,d0
  2596.  move.l LINKFILE,a6
  2597.  add.l #GunBulletTypes,a6
  2598.  move.w (a6,d0.w*8),d0
  2599.  
  2600.  move.l #PLAYERTWOAMMO,a6
  2601.  move.w (a6,d0.w*2),d0
  2602.  move.w d0,Ammo
  2603.  movem.l (a7)+,d0-d7/a0-a6
  2604.  
  2605.  move.w PLAYERTWOHEALTH,Energy
  2606.  
  2607.  jsr RECFIRST
  2608.  jsr SENDPAR
  2609.  
  2610.  move.l PLR2s_xoff,p2_xoff
  2611.  move.l PLR2s_zoff,p2_zoff
  2612.  move.l PLR2s_yoff,p2_yoff
  2613.  move.l PLR2s_height,p2_height
  2614.  move.w PLR2s_angpos,p2_angpos
  2615.  move.w PLR2_bobble,p2_bobble
  2616.  move.b PLR2_clicked,p2_clicked
  2617.  clr.b PLR2_clicked
  2618.  move.b PLR2_fire,p2_fire
  2619.  move.b PLR2_SPCTAP,p2_spctap
  2620.  clr.b PLR2_SPCTAP
  2621.  move.b PLR2_Ducked,p2_ducked
  2622.  move.b PLR2_GunSelected,p2_gunselected
  2623.  
  2624.  move.l PLR2_AIMSPD,d0
  2625.  jsr RECFIRST
  2626.  move.l d0,PLR1_AIMSPD
  2627.  
  2628.  move.l p2_xoff,d0
  2629.  jsr RECFIRST
  2630.  move.l d0,p1_xoff
  2631.  
  2632.  move.l p2_zoff,d0
  2633.  jsr RECFIRST
  2634.  move.l d0,p1_zoff
  2635.  
  2636.  move.l p2_yoff,d0
  2637.  jsr RECFIRST
  2638.  move.l d0,p1_yoff
  2639.  
  2640.  move.l p2_height,d0
  2641.  jsr RECFIRST
  2642.  move.l d0,p1_height
  2643.  
  2644.  move.w p2_angpos,d0
  2645.  swap d0
  2646.  move.w p2_bobble,d0
  2647.  jsr RECFIRST
  2648.  move.w d0,p1_bobble
  2649.  swap d0
  2650.  move.w d0,p1_angpos
  2651.  
  2652.  
  2653.  move.b p2_spctap,d0
  2654.  lsl.w #8,d0
  2655.  move.b p2_clicked,d0
  2656.  jsr RECFIRST
  2657.  move.b d0,p1_clicked
  2658.  lsr.w #8,d0
  2659.  move.b d0,p1_spctap
  2660.  swap d0
  2661.  move.w d0,TempFrames
  2662.  
  2663.  move.b p2_ducked,d0
  2664.  or.b PLR2_Squished,d0
  2665.  lsl.w #8,d0
  2666.  move.b p2_gunselected,d0
  2667.  jsr RECFIRST
  2668.  move.b d0,p1_gunselected
  2669.  lsr.w #8,d0
  2670.  move.b d0,p1_ducked
  2671.  swap d0
  2672.  move.w d0,Rand1
  2673.  
  2674.  move.b p2_fire,d0
  2675.  lsl.w #8,d0
  2676.  move.b PLR2QUITTING,d0
  2677.  or.b PLR1QUITTING,d0
  2678.  or.b PLR3QUITTING,d0
  2679.  swap d0
  2680.  move.b PLR2_PAUSE,d0
  2681.  or.b d0,PLR1_PAUSE
  2682.  or.b d0,PLR3_PAUSE
  2683.  jsr RECFIRST
  2684.  or.b d0,PLR1_PAUSE
  2685.  or.b d0,PLR2_PAUSE
  2686.  or.b d0,PLR3_PAUSE
  2687.  swap d0
  2688.  or.b d0,PLR1QUITTING
  2689.  or.b d0,PLR2QUITTING
  2690.  or.b d0,PLR3QUITTING
  2691.  lsr.w #8,d0
  2692.  move.b d0,p1_fire
  2693.  
  2694.  move.w PLAYERTWOHEALTH,d0
  2695.  jsr RECFIRST
  2696.  move.w d0,PLAYERONEHEALTH
  2697.  
  2698. *************************************** 
  2699.  move.l PLR2_AIMSPD,d0
  2700.  jsr SENDPAR
  2701.  move.l d0,PLR3_AIMSPD
  2702.  
  2703.  move.l p2_xoff,d0
  2704.  jsr SENDPAR
  2705.  move.l d0,p3_xoff
  2706.  
  2707.  move.l p2_zoff,d0
  2708.  jsr SENDPAR
  2709.  move.l d0,p3_zoff 
  2710.  
  2711.  move.l p2_yoff,d0
  2712.  jsr SENDPAR
  2713.  move.l d0,p3_yoff
  2714.   
  2715.  move.l p2_height,d0
  2716.  jsr SENDPAR
  2717.  move.l d0,p3_height
  2718.  
  2719.  move.w p2_angpos,d0
  2720.  swap d0
  2721.  move.w p2_bobble,d0
  2722.  jsr SENDPAR
  2723.  move.w d0,p3_bobble
  2724.  swap d0
  2725.  move.w d0,p3_angpos
  2726.  
  2727.  
  2728.  move.w TempFrames,d0
  2729.  swap d0
  2730.  move.b p2_spctap,d0
  2731.  lsl.w #8,d0
  2732.  move.b p2_clicked,d0
  2733.  jsr SENDPAR
  2734.  move.b d0,p3_clicked
  2735.  lsr.w #8,d0
  2736.  move.b d0,p3_spctap
  2737.  
  2738.  move.w Rand1,d0
  2739.  swap d0
  2740.  move.b p2_ducked,d0
  2741.  or.b PLR2_Squished,d0
  2742.  lsl.w #8,d0
  2743.  move.b p2_gunselected,d0
  2744.  jsr SENDPAR
  2745.  move.b d0,p3_gunselected
  2746.  lsr.w #8,d0
  2747.  move.b d0,p3_ducked
  2748.  
  2749.  move.b p2_fire,d0
  2750.  lsl.w #8,d0
  2751.  move.b PLR2QUITTING,d0
  2752.  or.b d0,PLR1QUITTING
  2753.  or.b d0,PLR3QUITTING
  2754.  swap d0
  2755.  move.b PLR2_PAUSE,d0
  2756.  or.b d0,PLR1_PAUSE
  2757.  or.b d0,PLR3_PAUSE
  2758.  jsr SENDPAR
  2759.  or.b d0,PLR1_PAUSE
  2760.  or.b d0,PLR2_PAUSE
  2761.  or.b d0,PLR3_PAUSE
  2762.  swap d0
  2763.  or.b d0,PLR1QUITTING
  2764.  or.b d0,PLR2QUITTING
  2765.  or.b d0,PLR3QUITTING
  2766.  lsr.w #8,d0
  2767.  move.b d0,p3_fire
  2768.  
  2769.  move.w PLAYERTWOHEALTH,d0
  2770.  jsr SENDPAR
  2771.  move.w d0,PLAYERTHREEHEALTH
  2772.  
  2773. *************************************** 
  2774.  move.l PLR1_AIMSPD,d0
  2775.  jsr SENDPAR
  2776.  move.l d0,PLR3_AIMSPD
  2777.  
  2778.  move.l p1_xoff,d0
  2779.  jsr SENDPAR
  2780.  move.l d0,p3_xoff
  2781.  
  2782.  move.l p1_zoff,d0
  2783.  jsr SENDPAR
  2784.  move.l d0,p3_zoff 
  2785.  
  2786.  move.l p1_yoff,d0
  2787.  jsr SENDPAR
  2788.  move.l d0,p3_yoff
  2789.   
  2790.  move.l p1_height,d0
  2791.  jsr SENDPAR
  2792.  move.l d0,p3_height
  2793.  
  2794.  move.w p1_angpos,d0
  2795.  swap d0
  2796.  move.w p1_bobble,d0
  2797.  jsr SENDPAR
  2798.  move.w d0,p3_bobble
  2799.  swap d0
  2800.  move.w d0,p3_angpos
  2801.  
  2802.  
  2803.  move.w TempFrames,d0
  2804.  swap d0
  2805.  move.b p1_spctap,d0
  2806.  lsl.w #8,d0
  2807.  move.b p1_clicked,d0
  2808.  jsr SENDPAR
  2809.  move.b d0,p3_clicked
  2810.  lsr.w #8,d0
  2811.  move.b d0,p3_spctap
  2812.  
  2813.  move.w Rand1,d0
  2814.  swap d0
  2815.  move.b p1_ducked,d0
  2816.  or.b PLR1_Squished,d0
  2817.  lsl.w #8,d0
  2818.  move.b p1_gunselected,d0
  2819.  jsr SENDPAR
  2820.  move.b d0,p3_gunselected
  2821.  lsr.w #8,d0
  2822.  move.b d0,p3_ducked
  2823.  
  2824.  move.b p1_fire,d0
  2825.  lsl.w #8,d0
  2826.  move.b PLR1QUITTING,d0
  2827.  or.b d0,PLR2QUITTING
  2828.  or.b d0,PLR3QUITTING
  2829.  swap d0
  2830.  move.b PLR1_PAUSE,d0
  2831.  or.b d0,PLR2_PAUSE
  2832.  or.b d0,PLR3_PAUSE
  2833.  jsr SENDPAR
  2834.  or.b d0,PLR1_PAUSE
  2835.  or.b d0,PLR2_PAUSE
  2836.  or.b d0,PLR3_PAUSE
  2837.  swap d0
  2838.  or.b d0,PLR1QUITTING
  2839.  or.b d0,PLR2QUITTING
  2840.  or.b d0,PLR3QUITTING
  2841.  lsr.w #8,d0
  2842.  move.b d0,p3_fire
  2843.  
  2844.  move.w PLAYERONEHEALTH,d0
  2845.  jsr SENDPAR
  2846.  move.w d0,PLAYERTHREEHEALTH
  2847.  
  2848. ************************************
  2849.  move.l PLR3_AIMSPD,d0
  2850.  jsr RECFIRST
  2851. ; move.l d0,PLR1_AIMSPD
  2852.  
  2853.  move.l p3_xoff,d0
  2854.  jsr RECFIRST
  2855. ; move.l d0,p1_xoff
  2856.  
  2857.  move.l p3_zoff,d0
  2858.  jsr RECFIRST
  2859. ; move.l d0,p1_zoff
  2860.  
  2861.  move.l p3_yoff,d0
  2862.  jsr RECFIRST
  2863. ; move.l d0,p1_yoff
  2864.  
  2865.  move.l p3_height,d0
  2866.  jsr RECFIRST
  2867. ; move.l d0,p1_height
  2868.  
  2869.  move.w p3_angpos,d0
  2870.  swap d0
  2871.  move.w p3_bobble,d0
  2872.  jsr RECFIRST
  2873. ; move.w d0,p1_bobble
  2874. ; swap d0
  2875. ; move.w d0,p1_angpos
  2876.  
  2877.  
  2878.  move.b p3_spctap,d0
  2879.  lsl.w #8,d0
  2880.  move.b p3_clicked,d0
  2881.  jsr RECFIRST
  2882. ; move.b d0,p1_clicked
  2883. ; lsr.w #8,d0
  2884. ; move.b d0,p1_spctap
  2885. ; swap d0
  2886. ; move.w d0,TempFrames
  2887.  
  2888.  move.b p3_ducked,d0
  2889.  or.b PLR3_Squished,d0
  2890.  lsl.w #8,d0
  2891.  move.b p3_gunselected,d0
  2892.  jsr RECFIRST
  2893. ; move.b d0,p1_gunselected
  2894. ; lsr.w #8,d0
  2895. ; move.b d0,p1_ducked
  2896. ; swap d0
  2897. ; move.w d0,Rand1
  2898.  
  2899.  move.b p3_fire,d0
  2900.  lsl.w #8,d0
  2901.  move.b PLR3QUITTING,d0
  2902.  or.b PLR2QUITTING,d0
  2903.  or.b PLR1QUITTING,d0
  2904.  swap d0
  2905.  move.b PLR3_PAUSE,d0
  2906.  or.b d0,PLR1_PAUSE
  2907.  or.b d0,PLR2_PAUSE
  2908.  jsr RECFIRST
  2909.  or.b d0,PLR1_PAUSE
  2910.  or.b d0,PLR2_PAUSE
  2911.  or.b d0,PLR3_PAUSE
  2912.  swap d0
  2913.  or.b d0,PLR1QUITTING
  2914.  or.b d0,PLR2QUITTING
  2915.  or.b d0,PLR3QUITTING
  2916. ; lsr.w #8,d0
  2917. ; move.b d0,p1_fire
  2918.  
  2919.  move.w PLAYERTHREEHEALTH,d0
  2920.  jsr RECFIRST
  2921. ; move.w d0,PLAYERONEHEALTH
  2922.  
  2923. *********************************
  2924. * Trigger plr3 into continuing **
  2925.  jsr SENDPAR
  2926. *********************************
  2927.  
  2928.  bsr PLR1_Control
  2929.  bsr PLR2_Control
  2930.  bsr PLR3_Control
  2931.  move.w p2_xoff,THISPLRxoff
  2932.  move.w p2_zoff,THISPLRzoff
  2933.  move.l PLR2_Roompt,a0
  2934.  move.l ToZoneRoof(a0),SplitHeight
  2935.  
  2936.  bra donetalking
  2937.  
  2938. PLR3stuff:
  2939.  
  2940.  move.l #KeyMap,a5
  2941.  tst.b $19(a5)
  2942.  sne PLR3_PAUSE
  2943.  
  2944.  movem.l d0-d7/a0-a6,-(a7)
  2945.  
  2946.  moveq #0,d0
  2947.  move.b GunSelected,d0
  2948.  move.l LINKFILE,a6
  2949.  add.l #GunBulletTypes,a6
  2950.  move.w (a6,d0.w*8),d0
  2951.  
  2952.  move.l #PLAYERTHREEAMMO,a6
  2953.  move.w (a6,d0.w*2),d0
  2954.  move.w d0,Ammo
  2955.  movem.l (a7)+,d0-d7/a0-a6
  2956.  
  2957.  move.w PLAYERTHREEHEALTH,Energy
  2958.  
  2959.  jsr RECPAR
  2960.  move.l PLR3s_xoff,p3_xoff
  2961.  move.l PLR3s_zoff,p3_zoff
  2962.  move.l PLR3s_yoff,p3_yoff
  2963.  move.l PLR3s_height,p3_height
  2964.  move.w PLR3s_angpos,p3_angpos
  2965.  move.w PLR3_bobble,p3_bobble
  2966.  move.b PLR3_clicked,p3_clicked
  2967.  clr.b PLR3_clicked
  2968.  move.b PLR3_fire,p3_fire
  2969.  move.b PLR3_SPCTAP,p3_spctap
  2970.  clr.b PLR3_SPCTAP
  2971.  move.b PLR3_Ducked,p3_ducked
  2972.  move.b PLR3_GunSelected,p3_gunselected
  2973.  
  2974. *************************************
  2975.  move.l PLR3_AIMSPD,d0
  2976.  jsr RECPAR
  2977.  move.l d0,PLR2_AIMSPD
  2978.  
  2979.  move.l p3_xoff,d0
  2980.  jsr RECPAR
  2981.  move.l d0,p2_xoff
  2982.  
  2983.  move.l p3_zoff,d0
  2984.  jsr RECPAR
  2985.  move.l d0,p2_zoff 
  2986.  
  2987.  move.l p3_yoff,d0
  2988.  jsr RECPAR
  2989.  move.l d0,p2_yoff
  2990.   
  2991.  move.l p3_height,d0
  2992.  jsr RECPAR
  2993.  move.l d0,p2_height
  2994.  
  2995.  move.w p3_angpos,d0
  2996.  swap d0
  2997.  move.w p3_bobble,d0
  2998.  jsr RECPAR
  2999.  move.w d0,p2_bobble
  3000.  swap d0
  3001.  move.w d0,p2_angpos
  3002.  
  3003.  move.b p3_spctap,d0
  3004.  lsl.w #8,d0
  3005.  move.b p3_clicked,d0
  3006.  jsr RECPAR
  3007.  move.b d0,p2_clicked
  3008.  lsr.w #8,d0
  3009.  move.b d0,p2_spctap
  3010.  swap d0
  3011.  move.w d0,TempFrames
  3012.  
  3013.  move.b p3_ducked,d0
  3014.  or.b PLR3_Squished,d0
  3015.  lsl.w #8,d0
  3016.  move.b p3_gunselected,d0
  3017.  jsr RECPAR
  3018.  move.b d0,p2_gunselected
  3019.  lsr.w #8,d0
  3020.  move.b d0,p2_ducked
  3021.  swap d0
  3022.  move.w d0,Rand1 
  3023.  
  3024.  move.b p3_fire,d0
  3025.  lsl.w #8,d0
  3026.  move.b PLR3QUITTING,d0
  3027.  or.b d0,PLR1QUITTING
  3028.  or.b d0,PLR2QUITTING
  3029.  swap d0
  3030.  move.b PLR3_PAUSE,d0
  3031.  or.b d0,PLR1_PAUSE
  3032.  or.b d0,PLR2_PAUSE
  3033.  jsr RECPAR
  3034.  or.b d0,PLR1_PAUSE
  3035.  or.b d0,PLR2_PAUSE
  3036.  or.b d0,PLR3_PAUSE
  3037.  swap d0
  3038.  or.b d0,PLR1QUITTING
  3039.  or.b d0,PLR2QUITTING
  3040.  or.b d0,PLR3QUITTING
  3041.  lsr.w #8,d0
  3042.  move.b d0,p2_fire
  3043.  
  3044.  move.w PLAYERTHREEHEALTH,d0
  3045.  jsr RECPAR
  3046.  move.w d0,PLAYERTWOHEALTH
  3047.  
  3048. *************************************
  3049.  move.l PLR3_AIMSPD,d0
  3050.  jsr RECPAR
  3051.  move.l d0,PLR1_AIMSPD
  3052.  
  3053.  move.l p3_xoff,d0
  3054.  jsr RECPAR
  3055.  move.l d0,p1_xoff
  3056.  
  3057.  move.l p3_zoff,d0
  3058.  jsr RECPAR
  3059.  move.l d0,p1_zoff 
  3060.  
  3061.  move.l p3_yoff,d0
  3062.  jsr RECPAR
  3063.  move.l d0,p1_yoff
  3064.   
  3065.  move.l p3_height,d0
  3066.  jsr RECPAR
  3067.  move.l d0,p1_height
  3068.  
  3069.  move.w p3_angpos,d0
  3070.  swap d0
  3071.  move.w p3_bobble,d0
  3072.  jsr RECPAR
  3073.  move.w d0,p1_bobble
  3074.  swap d0
  3075.  move.w d0,p1_angpos
  3076.  
  3077.  move.b p3_spctap,d0
  3078.  lsl.w #8,d0
  3079.  move.b p3_clicked,d0
  3080.  jsr RECPAR
  3081.  move.b d0,p1_clicked
  3082.  lsr.w #8,d0
  3083.  move.b d0,p1_spctap
  3084.  swap d0
  3085.  move.w d0,TempFrames
  3086.  
  3087.  move.b p3_ducked,d0
  3088.  or.b PLR3_Squished,d0
  3089.  lsl.w #8,d0
  3090.  move.b p3_gunselected,d0
  3091.  jsr RECPAR
  3092.  move.b d0,p1_gunselected
  3093.  lsr.w #8,d0
  3094.  move.b d0,p1_ducked
  3095.  swap d0
  3096.  move.w d0,Rand1 
  3097.  
  3098.  move.b p3_fire,d0
  3099.  lsl.w #8,d0
  3100.  move.b PLR3QUITTING,d0
  3101.  or.b d0,PLR1QUITTING
  3102.  or.b d0,PLR2QUITTING
  3103.  swap d0
  3104.  move.b PLR3_PAUSE,d0
  3105.  or.b d0,PLR1_PAUSE
  3106.  or.b d0,PLR2_PAUSE
  3107.  jsr RECPAR
  3108.  or.b d0,PLR1_PAUSE
  3109.  or.b d0,PLR2_PAUSE
  3110.  or.b d0,PLR3_PAUSE
  3111.  swap d0
  3112.  or.b d0,PLR1QUITTING
  3113.  or.b d0,PLR2QUITTING
  3114.  or.b d0,PLR3QUITTING
  3115.  lsr.w #8,d0
  3116.  move.b d0,p2_fire
  3117.  
  3118.  move.w PLAYERTHREEHEALTH,d0
  3119.  jsr RECPAR
  3120.  move.w d0,PLAYERONEHEALTH
  3121.  
  3122.  
  3123. *************************************
  3124. ***** Wait for others to finish.*****
  3125.  jsr RECPAR
  3126. *************************************
  3127. *************************************
  3128. *********************************
  3129.  
  3130.  bsr PLR1_Control
  3131.  bsr PLR2_Control
  3132.  bsr PLR3_Control
  3133.  move.w p2_xoff,THISPLRxoff
  3134.  move.w p2_zoff,THISPLRzoff
  3135.  move.l PLR2_Roompt,a0
  3136.  move.l ToZoneRoof(a0),SplitHeight
  3137.  
  3138.  
  3139. donetalking:
  3140.  
  3141.  
  3142.  move.l #ZoneBrightTable,a1
  3143.  move.l ZoneAdds,a2
  3144.  move.l PLR2_ListOfGraphRooms,a0
  3145. ; move.l PLR2_PointsToRotatePtr,a5
  3146.  move.l a0,a5
  3147.  cmp.b #'s',mors
  3148.  beq.s doallz
  3149.  move.l PLR1_ListOfGraphRooms,a0
  3150. ; move.l PLR1_PointsToRotatePtr,a5
  3151.  move.l a0,a5 
  3152. doallz
  3153.  move.w (a0),d0
  3154.  blt.s doneallz
  3155.  add.w #8,a0
  3156.  
  3157.  move.l (a2,d0.w*4),a3
  3158.  add.l LEVELDATA,a3
  3159.  move.w ToZoneBrightness(a3),d2
  3160.  
  3161.  blt.s justbright
  3162.  move.w d2,d3
  3163.  lsr.w #8,d3
  3164.  tst.b d3
  3165.  beq.s justbright
  3166.  
  3167.  move.l #BrightAnimTable,a4
  3168.  move.w -2(a4,d3.w*2),d2
  3169.  
  3170. justbright:
  3171.  muls #32,d2
  3172.  divs #20,d2
  3173.  move.w d2,(a1,d0.w*4)
  3174.  
  3175.  move.w ToUpperBrightness(a3),d2
  3176.  
  3177.  blt.s justbright2
  3178.  move.w d2,d3
  3179.  lsr.w #8,d3
  3180.  tst.b d3
  3181.  beq.s justbright2
  3182.  
  3183.  move.l #BrightAnimTable,a4
  3184.  move.w -2(a4,d3.w*2),d2
  3185.  
  3186. justbright2:
  3187.  
  3188.  muls #32,d2
  3189.  divs #20,d2
  3190.  move.w d2,2(a1,d0.w*4)
  3191.  
  3192.  bra doallz
  3193.  
  3194. doneallz:
  3195.  
  3196.  move.l PointBrights,a2
  3197.  move.l #CurrentPointBrights,a3
  3198. justtheone:
  3199.  move.w (a5),d0
  3200.  blt whythehell
  3201.  addq #8,a5
  3202.  
  3203.  muls #40,d0
  3204.  
  3205.  move.w #39,d7
  3206.  
  3207. allinzone:
  3208.  move.w (a2,d0.w*2),d2
  3209.  
  3210.  tst.b d2
  3211.  blt.s .justbright
  3212.  move.w d2,d3
  3213.  lsr.w #8,d3
  3214.  tst.b d3
  3215.  beq.s .justbright
  3216.  
  3217.  move.w d3,d4
  3218.  and.w #$f,d3
  3219.  lsr.w #4,d4
  3220.  add.w #1,d4
  3221.  move.l #BrightAnimTable,a0
  3222.  move.w -2(a0,d3.w*2),d3
  3223.  ext.w d2
  3224.  sub.w d2,d3
  3225.  muls d4,d3
  3226.  asr.w #4,d3
  3227.  add.w d3,d2
  3228.  
  3229. .justbright:
  3230.  ext.w d2
  3231.  
  3232.  muls #31,d2
  3233.  divs #20,d2
  3234.  bge.s .itspos
  3235.  sub.w #600,d2
  3236. .itspos:
  3237.  add.w #300,d2
  3238.  
  3239.  move.w d2,(a3,d0.w*2)
  3240.  addq #1,d0
  3241.  dbra d7,allinzone
  3242.  
  3243.  bra justtheone
  3244.  
  3245. whythehell:
  3246.  
  3247.  move.l PLR1_Roompt,a0
  3248.  move.l #CurrentPointBrights,a1
  3249.  move.l ZoneBorderPts,a2
  3250.  move.w (a0),d0
  3251.  muls #10,d0
  3252.  lea (a2,d0.w*2),a2
  3253.  lea (a1,d0.w*8),a1
  3254.  
  3255.  moveq #9,d7
  3256.  moveq #0,d0
  3257.  moveq #0,d1
  3258. findaverage:
  3259.  tst.w (a2)+
  3260.  blt.s .foundaverage
  3261.  addq #1,d0
  3262.  move.w (a1)+,d2
  3263.  bge.s .okpos
  3264.  neg.w d2
  3265. .okpos:
  3266.  add.w d2,d1
  3267.  
  3268.  dbra d7,findaverage
  3269.  
  3270. .foundaverage:
  3271.  
  3272.  ext.l d1
  3273.  divs d0,d1
  3274.  sub.w #300,d1
  3275.  move.w d1,PLR1_RoomBright
  3276.  
  3277.  cmp.b #'n',mors
  3278.  beq nosee
  3279.  
  3280.  move.l PLR1_Roompt,FromRoom
  3281.  move.l PLR2_Roompt,ToRoom
  3282.  move.w p1_xoff,Viewerx
  3283.  move.w p1_zoff,Viewerz
  3284.  move.l p1_yoff,d0
  3285.  asr.l #7,d0
  3286.  move.w d0,Viewery
  3287.  move.w p2_xoff,Targetx
  3288.  move.w p2_zoff,Targetz
  3289.  move.l p2_yoff,d0
  3290.  asr.l #7,d0
  3291.  move.w d0,Targety
  3292.  move.b PLR1_StoodInTop,ViewerTop
  3293.  move.b PLR2_StoodInTop,TargetTop
  3294.  jsr CanItBeSeen
  3295.  
  3296.  move.l PLR1_Obj,a0
  3297.  move.b CanSee,d0
  3298.  and.b #2,d0
  3299.  move.b d0,17(a0)
  3300.  move.l PLR2_Obj,a0
  3301.  move.b CanSee,d0
  3302.  and.b #1,d0
  3303.  move.b d0,17(a0)
  3304.  
  3305. nosee:
  3306.  
  3307.  
  3308.  move.w TempFrames,d0
  3309.  add.w d0,p1_holddown
  3310.  cmp.w #30,p1_holddown
  3311.  blt.s oklength
  3312.  move.w #30,p1_holddown
  3313. oklength:
  3314.  
  3315.  tst.b p1_fire
  3316.  bne.s okstillheld
  3317.  sub.w d0,p1_holddown
  3318.  bge.s okstillheld
  3319.  move.w #0,p1_holddown
  3320.  
  3321. okstillheld:
  3322.  
  3323.  move.w TempFrames,d0
  3324.  add.w d0,p2_holddown
  3325.  
  3326.  cmp.w #30,p2_holddown
  3327.  blt.s oklength2
  3328.  move.w #30,p2_holddown
  3329. oklength2:
  3330.  
  3331.  
  3332.  tst.b p2_fire
  3333.  bne.s okstillheld2
  3334.  sub.w d0,p2_holddown
  3335.  bge.s okstillheld2
  3336.  move.w #0,p2_holddown
  3337. okstillheld2:
  3338.  
  3339. ***** CHECKING LIGHT *********
  3340.  
  3341. ; move.w #-20,d0
  3342. ; move.w PLR1_xoff,d1
  3343. ; move.w PLR1_zoff,d2
  3344. ; move.l PLR1_Roompt,a0
  3345. ; move.w (a0),d3
  3346. ; move.w PLR1_angpos,d4
  3347. ;
  3348. ; jsr BRIGHTENPOINTSANGLE
  3349.  
  3350. ******************************
  3351.  
  3352. ; move.l #PLR1_GunData,a1
  3353. ; move.w p1_holddown,d0
  3354. ; move.w #50,10+32*3(a1)
  3355. ; move.l #PLR2_GunData,a1
  3356. ; move.w p2_holddown,d0
  3357. ; move.w #50,10+32*3(a1)
  3358.  
  3359. ******************************************
  3360. ******************************************
  3361.  
  3362.  move.w TempFrames,d1
  3363.  bgt.s noze
  3364.  moveq #1,d1
  3365. noze:
  3366.  
  3367.  move.w PLR1_xoff,d0
  3368.  sub.w OLDX1,d0
  3369.  asl.w #4,d0
  3370.  ext.l d0
  3371.  divs d1,d0
  3372.  move.w d0,XDIFF1
  3373.  move.w PLR2_xoff,d0
  3374.  sub.w OLDX2,d0
  3375.  asl.w #4,d0
  3376.  ext.l d0
  3377.  divs d1,d0
  3378.  move.w d0,XDIFF2
  3379.  move.w PLR1_zoff,d0
  3380.  sub.w OLDZ1,d0
  3381.  asl.w #4,d0
  3382.  ext.l d0
  3383.  divs d1,d0
  3384.  move.w d0,ZDIFF1
  3385.  move.w PLR2_zoff,d0
  3386.  sub.w OLDZ2,d0
  3387.  asl.w #4,d0
  3388.  ext.l d0
  3389.  divs d1,d0
  3390.  move.w d0,ZDIFF2
  3391.  
  3392.  cmp.b #'2',mors
  3393.  bgt.s Implayer3
  3394.  beq.s ImPlayer2OhYesIAm
  3395.  bsr USEPLR1
  3396.  bra IWasPlayer1
  3397.  
  3398. ImPlayer2OhYesIAm:
  3399.  bsr USEPLR2
  3400.  bra IWasPlayer1
  3401.  
  3402. Implayer3
  3403.  bsr USEPLR3 
  3404.  
  3405. IWasPlayer1:
  3406.  
  3407.  
  3408.  cmp.b #'2',WHICHAMI
  3409.  bgt drawplayer3
  3410.  beq drawplayer2
  3411.  
  3412.  move.w #0,scaleval
  3413.  
  3414.  move.l PLR1_xoff,xoff
  3415.  move.l PLR1_yoff,yoff
  3416.  move.l PLR1_zoff,zoff
  3417.  move.w PLR1_angpos,angpos
  3418.  move.w PLR1_cosval,cosval
  3419.  move.w PLR1_sinval,sinval
  3420.  
  3421.  
  3422.  move.l PLR1_ListOfGraphRooms,ListOfGraphRooms
  3423.  move.l PLR1_PointsToRotatePtr,PointsToRotatePtr
  3424.  move.b PLR1_Echo,PLREcho
  3425.  move.l PLR1_Roompt,Roompt
  3426.  
  3427.  move.l #KeyMap,a5
  3428.  moveq #0,d5
  3429.  move.b look_behind_key,d5
  3430.  tst.b (a5,d5.w)
  3431.  beq.s .nolookback
  3432.  
  3433.  move.l GUN_OBJ,a0
  3434.  move.w #-1,12(a0)
  3435.  
  3436.  eor.w #4096,angpos 
  3437.  neg.w cosval
  3438.  neg.w sinval
  3439. .nolookback:
  3440.  
  3441.  jsr OrderZones
  3442.  jsr objmoveanim
  3443.  jsr EnergyBar
  3444.  jsr AmmoBar
  3445.  
  3446.  
  3447. ;********************************************
  3448. ;************* Do reflection ****************
  3449. ;
  3450. ; move.l ListOfGraphRooms,a0
  3451. ; move.l ZoneAdds,a1
  3452. ;checkwaterheights
  3453. ; move.w (a0),d0
  3454. ; blt allzonesdone
  3455. ; addq #8,a0
  3456. ; move.l (a1,d0.w*4),a2
  3457. ; add.l LEVELDATA,a2
  3458. ; move.l ToZoneWater(a2),d0
  3459. ; cmp.l ToZoneFloor(a2),d0
  3460. ; blt.s WEHAVEAHEIGHT
  3461. ; bra.s checkwaterheights
  3462. ;
  3463. ;WEHAVEAHEIGHT:
  3464. ;
  3465. ; sub.l yoff,d0
  3466. ; blt.s underwater
  3467. ; add.l d0,d0
  3468. ; add.l d0,yoff
  3469. ; move.l FASTBUFFER2,FASTBUFFER
  3470. ; move.w #0,leftclip
  3471. ; move.w RIGHTX,rightclip
  3472. ; move.w #0,deftopclip
  3473. ; move.w #BOTTOMY/2,defbotclip
  3474. ; move.w #0,topclip
  3475. ; move.w #BOTTOMY/2,botclip
  3476. ;
  3477. ; clr.b DOANYWATER 
  3478. ; bsr DrawDisplay
  3479. ;allzonesdone:
  3480. ;underwater:
  3481.  
  3482. ********************************************
  3483.  
  3484.  st DOANYWATER
  3485.  
  3486.  move.l PLR1_yoff,yoff
  3487.  
  3488.  move.w #0,leftclip
  3489.  move.w RIGHTX,rightclip
  3490.  move.w #0,deftopclip
  3491.  move.w WIDESCRN,d0
  3492.  add.w d0,deftopclip
  3493.  
  3494.  move.w BOTTOMY,defbotclip
  3495.  sub.w d0,defbotclip
  3496.  move.w #0,topclip
  3497.  add.w d0,topclip
  3498.  move.w BOTTOMY,botclip
  3499.  sub.w d0,botclip
  3500. ; sub.l #10*104*4,frompt
  3501. ; sub.l #10*104*4,midpt
  3502.  
  3503. * Subroom loop
  3504.  
  3505.  bsr DrawDisplay 
  3506.  
  3507.  bra nodrawp2
  3508.  
  3509. drawplayer2
  3510.  
  3511.  move.w #0,scaleval
  3512.  move.l PLR2_xoff,xoff
  3513.  move.l PLR2_yoff,yoff
  3514.  move.l PLR2_zoff,zoff
  3515.  move.w PLR2_angpos,angpos
  3516.  move.w PLR2_cosval,cosval
  3517.  move.w PLR2_sinval,sinval 
  3518.  
  3519.  
  3520.  
  3521.  move.l PLR2_ListOfGraphRooms,ListOfGraphRooms
  3522.  move.l PLR2_PointsToRotatePtr,PointsToRotatePtr
  3523.  move.b PLR2_Echo,PLREcho
  3524.  move.l PLR2_Roompt,Roompt
  3525.  
  3526.  move.l #KeyMap,a5
  3527.  moveq #0,d5
  3528.  move.b look_behind_key,d5
  3529.  tst.b (a5,d5.w)
  3530.  beq.s .nolookback
  3531.  
  3532.  move.l GUN_OBJ,a0
  3533.  move.w #-1,12(a0)
  3534.  eor.w #4096,angpos 
  3535.  
  3536.  neg.w cosval
  3537.  neg.w sinval
  3538. .nolookback:
  3539.  
  3540.  jsr OrderZones
  3541.  jsr objmoveanim
  3542.  jsr EnergyBar
  3543.  jsr AmmoBar
  3544.  
  3545.  move.w WIDESCRN,d0
  3546.  
  3547.  move.w #0,leftclip
  3548.  move.w RIGHTX,rightclip
  3549.  move.w #0,deftopclip
  3550.  add.w d0,deftopclip
  3551.  move.w BOTTOMY,defbotclip
  3552.  sub.w d0,defbotclip
  3553.  move.w #0,topclip
  3554.  add.w d0,topclip
  3555.  move.w BOTTOMY,botclip
  3556.  sub.w d0,botclip
  3557.  
  3558.  st DOANYWATER
  3559.  bsr DrawDisplay
  3560.  
  3561.  bra nodrawp2
  3562.  
  3563. drawplayer3:
  3564.  
  3565.  move.w #0,scaleval
  3566.  move.l PLR3_xoff,xoff
  3567.  move.l PLR3_yoff,yoff
  3568.  move.l PLR3_zoff,zoff
  3569.  move.w PLR3_angpos,angpos
  3570.  move.w PLR3_cosval,cosval
  3571.  move.w PLR3_sinval,sinval 
  3572.  
  3573.  
  3574.  
  3575.  move.l PLR3_ListOfGraphRooms,ListOfGraphRooms
  3576.  move.l PLR3_PointsToRotatePtr,PointsToRotatePtr
  3577.  move.b PLR3_Echo,PLREcho
  3578.  move.l PLR3_Roompt,Roompt
  3579.  
  3580.  move.l #KeyMap,a5
  3581.  moveq #0,d5
  3582.  move.b look_behind_key,d5
  3583.  tst.b (a5,d5.w)
  3584.  beq.s .nolookback
  3585.  
  3586.  move.l GUN_OBJ,a0
  3587.  move.w #-1,12(a0)
  3588.  eor.w #4096,angpos 
  3589.  
  3590.  neg.w cosval
  3591.  neg.w sinval
  3592. .nolookback:
  3593.  
  3594.  jsr OrderZones
  3595.  jsr objmoveanim
  3596.  jsr EnergyBar
  3597.  jsr AmmoBar
  3598.  
  3599.  move.w WIDESCRN,d0
  3600.  
  3601.  move.w #0,leftclip
  3602.  move.w RIGHTX,rightclip
  3603.  move.w #0,deftopclip
  3604.  add.w d0,deftopclip
  3605.  move.w BOTTOMY,defbotclip
  3606.  sub.w d0,defbotclip
  3607.  move.w #0,topclip
  3608.  add.w d0,topclip
  3609.  move.w BOTTOMY,botclip
  3610.  sub.w d0,botclip
  3611.  
  3612.  st DOANYWATER
  3613.  bsr DrawDisplay
  3614.  
  3615.  
  3616. nodrawp2:
  3617.  
  3618. ***************************************** 
  3619. * Copy from copbuff to chip ram
  3620.  
  3621.  
  3622. ; move.l drawpt,a3
  3623. ; adda.w #10,a3
  3624. ; move.l COPSCRNBUFF,a2
  3625. ; move.w #2,d6
  3626. ; adda.w #10,a2
  3627. ;COPYOUT
  3628. ; move.w #31,d0
  3629. ;COPYDOWN1:
  3630. ; move.w #3,d1
  3631. ; move.l a2,a4
  3632. ; move.l a3,a5
  3633. ;.inlop1:
  3634. ;val SET 0
  3635. ; REPT 20
  3636. ; move.w val(a4),val(a5)
  3637. ;val SET val+104*4
  3638. ; ENDR
  3639. ; adda.l #104*4*20,a4
  3640. ; adda.l #104*4*20,a5
  3641. ; dbra d1,.inlop1
  3642. ; addq #4,a2
  3643. ; addq #4,a3
  3644. ; dbra d0,COPYDOWN1
  3645. ; addq #4,a2
  3646. ; addq #4,a3
  3647. ; dbra d6,COPYOUT 
  3648.  
  3649.  tst.b REALMAPON
  3650.  beq.s .nomap
  3651.  bsr DoTheMapWotNastyCharlesIsForcingMeToDo
  3652. .nomap
  3653.  
  3654.  move.w WIDESCRN,d7
  3655.  
  3656.  tst.b FULLSCR
  3657.  beq nobigconv
  3658.  
  3659.  move.l FASTBUFFER,a0
  3660. ; add.l #320*2*20,a0
  3661.  move.w d7,d6
  3662.  muls #320,d6
  3663.  add.l d6,a0
  3664.  move.l SCRNDRAWPT,a1
  3665.  move.w d7,d6
  3666.  muls #40,d6
  3667.  add.l d6,a1
  3668.  add.l #2,a1
  3669.  move.l #(288/8)-1,d0
  3670.  move.l #231,d1
  3671.  sub.w d7,d1
  3672.  sub.w d7,d1
  3673.  blt nochunk
  3674.  move.w #(320-288),d2
  3675.  move.w #4,d3
  3676.  
  3677.  bra donebigconv
  3678.  
  3679. nobigconv:
  3680.  
  3681.  move.l FASTBUFFER,a0
  3682.  move.w d7,d6
  3683.  muls #320,d6
  3684.  add.l d6,a0
  3685.  move.l SCRNDRAWPT,a1
  3686.  add.l #8+40*20,a1
  3687.  move.w d7,d6
  3688.  muls #40,d6
  3689.  add.l d6,a1
  3690.  move.l #(192/8)-1,d0
  3691.  move.l #159,d1
  3692.  sub.w d7,d1
  3693.  sub.w d7,d1
  3694.  blt nochunk
  3695.  move.w #(320-192),d2
  3696.  move.w #16,d3
  3697. donebigconv
  3698.  
  3699.  tst.b DOUBLEHEIGHT
  3700.  beq.s .nodoub
  3701.  asr.w #1,d1
  3702.  blt nochunk
  3703.  add.w #320,d2
  3704.  add.w #40,d3
  3705. .nodoub:
  3706.  
  3707.  move.b DOUBLEWIDTH,d4
  3708.  
  3709.  move.b PLR1_TELEPORTED,d5
  3710.  clr.b PLR1_TELEPORTED
  3711.  cmp.b #'s',mors
  3712.  bne.s .notplr2
  3713.  move.b PLR2_TELEPORTED,d5
  3714.  clr.b PLR2_TELEPORTED
  3715. .notplr2
  3716.  jsr CHUNKYTOPLANAR 
  3717.  
  3718. nochunk:
  3719.  
  3720.  
  3721.  move.l #KeyMap,a5
  3722.  tst.b $4a(a5)
  3723.  beq .nosmallscr
  3724.  
  3725.  move.w #100,d2
  3726.  move.l #0,d7
  3727.  move.l #0,d6
  3728.  tst.b FULLSCR
  3729.  bne.s .attop
  3730.  move.l #40*20,d7
  3731.  move.l #40*52,d6
  3732.  move.w #60,d2
  3733. .attop:
  3734.  
  3735.  move.w WIDESCRN,d0
  3736.  move.l SCRNDRAWPT,a0
  3737.  add.l d7,a0
  3738.  muls #40,d0
  3739.  add.l d0,a0
  3740.  bsr CLRTWOLINES
  3741.  move.w WIDESCRN,d0
  3742.  move.l SCRNSHOWPT,a0
  3743.  add.l d7,a0
  3744.  muls #40,d0
  3745.  add.l d0,a0
  3746.  bsr CLRTWOLINES
  3747.  
  3748.  
  3749.  add.w #2,WIDESCRN
  3750.  
  3751.  cmp.w WIDESCRN,d2
  3752.  bgt.s .okwide
  3753.  move.w d2,WIDESCRN
  3754. .okwide:
  3755.  
  3756.  move.l SCRNDRAWPT,a0
  3757.  add.l #232*40,a0
  3758.  sub.l d6,a0
  3759.  move.w WIDESCRN,d0
  3760.  muls #40,d0
  3761.  sub.l d0,a0
  3762.  bsr CLRTWOLINES
  3763.  move.l SCRNSHOWPT,a0
  3764.  sub.l d6,a0
  3765.  add.l #232*40,a0
  3766.  move.w WIDESCRN,d0
  3767.  muls #40,d0
  3768.  sub.l d0,a0
  3769.  bsr CLRTWOLINES
  3770.  
  3771. .nosmallscr
  3772.  
  3773.  tst.b $5e(a5)
  3774.  beq.s .nobigscr
  3775.  tst.w WIDESCRN
  3776.  ble.s .nobigscr
  3777.  
  3778.  sub.w #2,WIDESCRN
  3779.  
  3780. .nobigscr
  3781.  
  3782.  
  3783. ; tst.b (a5)
  3784. ; beq.s .nosavescrn
  3785. ;
  3786. ; not.b USEDOUG
  3787. ;
  3788. ; jsr SAVETHESCREEN
  3789. ;
  3790. ;.nosavescrn:
  3791.  
  3792.  tst.b $5b(a5)
  3793.  beq notdoubheight
  3794.  tst.b LASTDH
  3795.  bne notdoubheight2
  3796.  move.l SCRNSHOWPT,a0
  3797.  jsr WIPEDISPLAY
  3798.  move.l SCRNDRAWPT,a0
  3799.  jsr WIPEDISPLAY
  3800.  st LASTDH 
  3801.  
  3802.  move.w #0,d0
  3803.  move.w #0,d1
  3804.  
  3805.  not.b DOUBLEHEIGHT
  3806.  beq.s singlepixheight
  3807.  move.w #-40,d0
  3808.  move.w #40,d1
  3809.  
  3810. singlepixheight:
  3811.  
  3812.  move.l #SCRMODULOS,a0
  3813.  move.w #115,d2
  3814. putinmode:
  3815.  move.w d0,6(a0)
  3816.  move.w d0,6+4(a0)
  3817.  move.w d1,6+16(a0)
  3818.  move.w d1,6+16+4(a0)
  3819.  add.w #32,a0
  3820.  dbra d2,putinmode
  3821.  
  3822.  bra notdoubheight2
  3823.  
  3824. notdoubheight:
  3825.  clr.b LASTDH
  3826. notdoubheight2
  3827.  
  3828.  tst.b $5a(a5)
  3829.  beq.s notdoubwidth
  3830.  tst.b LASTDW
  3831.  bne notdoubwidth2
  3832.  move.l SCRNSHOWPT,a0
  3833.  jsr WIPEDISPLAY
  3834.  move.l SCRNDRAWPT,a0
  3835.  jsr WIPEDISPLAY
  3836.  st LASTDW
  3837.  not.b DOUBLEWIDTH
  3838.  bra.s notdoubwidth2
  3839.  
  3840. notdoubwidth:
  3841.  clr.b LASTDW
  3842. notdoubwidth2:
  3843.  
  3844. ***************************************** 
  3845.  move.l PLR2_Roompt,a0
  3846.  move.l #WorkSpace,a1
  3847.  clr.l (a1)
  3848.  clr.l 4(a1)
  3849.  clr.l 8(a1)
  3850.  clr.l 12(a1)
  3851.  clr.l 16(a1)
  3852.  clr.l 20(a1)
  3853.  clr.l 24(a1)
  3854.  clr.l 28(a1)
  3855.  
  3856.  cmp.b #'n',mors
  3857.  beq.s plr1only
  3858.  
  3859.  lea ToListOfGraph(a0),a0
  3860. .doallrooms:
  3861.  move.w (a0),d0
  3862.  blt.s .allroomsdone
  3863.  addq #8,a0
  3864.  move.w d0,d1
  3865.  asr.w #3,d0
  3866.  bset d1,(a1,d0.w)
  3867.  bra .doallrooms
  3868. .allroomsdone:
  3869.  
  3870. plr1only:
  3871.  
  3872.  move.l PLR1_Roompt,a0
  3873.  lea ToListOfGraph(a0),a0
  3874. .doallrooms2:
  3875.  move.w (a0),d0
  3876.  blt.s .allroomsdone2
  3877.  addq #8,a0
  3878.  move.w d0,d1
  3879.  asr.w #3,d0
  3880.  bset d1,(a1,d0.w)
  3881.  bra .doallrooms2
  3882. .allroomsdone2:
  3883.  
  3884.  move.l #%000001,d7
  3885.  lea TEAMWORK,a2
  3886.  move.l ObjectData,a0
  3887.  sub.w #64,a0
  3888. .doallobs:
  3889.  add.w #64,a0
  3890.  move.w (a0),d0
  3891.  blt.s .allobsdone
  3892.  move.w 12(a0),d0
  3893.  blt.s .doallobs
  3894.  move.w d0,d1
  3895.  asr.w #3,d0
  3896.  btst d1,(a1,d0.w)
  3897.  bne.s .worryobj
  3898.  move.b 16(a0),d0
  3899.  btst d0,d7
  3900.  beq.s .doallobs
  3901.  moveq #0,d0
  3902.  move.b teamnumber(a0),d0
  3903.  blt.s .doallobs
  3904.  asl.w #4,d0
  3905.  tst.w SEENBY(a2,d0.w)
  3906.  blt.s .doallobs
  3907. .worryobj:
  3908.  or.b #127,worry(a0)
  3909.  bra.s .doallobs
  3910. .allobsdone:
  3911.  
  3912.  
  3913.  
  3914. ; move.l #brightentab,a0
  3915. ; move.l frompt,a3
  3916. ; adda.w #(4*33)+(104*4*20),a3
  3917. ; move.w #20,d7
  3918. ; move.w #20,d6
  3919. ;horl:
  3920. ; move.w d6,d5
  3921. ; move.l a3,a1
  3922. ;vertl
  3923. ; move.w (a1),d0
  3924. ; move.w (a0,d0.w*2),(a1)
  3925. ; addq #4,a1
  3926. ; dbra d5,vertl
  3927. ; adda.w #104*4,a3
  3928. ; dbra d7,horl
  3929.  
  3930.  move.l #$dff000,a6
  3931.  
  3932. ; move.w #$300,col0(a6)
  3933.  
  3934.  move.l #KeyMap,a5
  3935.  tst.b $45(a5)
  3936.  beq.s noend
  3937.  
  3938.  cmp.b #'s',mors
  3939.  beq plr2quit 
  3940.  
  3941.  st MASTERQUITTING
  3942.  bra noend
  3943.  
  3944. plr2quit:
  3945.  st SLAVEQUITTING
  3946. noend:
  3947.  
  3948.  tst.b MASTERQUITTING
  3949.  beq.s .noquit
  3950.  tst.b SLAVEQUITTING
  3951.  beq.s .noquit
  3952.  jmp endnomusic
  3953. .noquit
  3954.  
  3955.  cmp.b #'n',mors
  3956.  bne.s noexit
  3957.  move.l PLR1_Roompt,a0
  3958.  move.w (a0),d0
  3959. ; move.w PLOPT,d1
  3960. ; move.l #ENDZONES,a0
  3961. ; cmp.w (a0,d1.w*2),d0
  3962.  
  3963.  cmp.w ENDZONE,d0
  3964.  
  3965. ; change this for quick exit, charlie
  3966. zzzz:
  3967. ; bra end
  3968.  
  3969.  bne.s noexit
  3970.  add.w #2,TELVAL
  3971.  cmp.w #9,TELVAL
  3972.  blt noexit
  3973.  
  3974.  jmp end
  3975. noexit:
  3976.  
  3977. ; tst.w PLAYERONEHEALTH
  3978. ; bgt nnoend1
  3979. ; jmp end
  3980. ;nnoend1:
  3981. ; tst.w PLAYERTWOHEALTH
  3982. ; bgt nnoend2
  3983. ; jmp end
  3984. ;nnoend2:
  3985.  
  3986. ; move.l SwitchData,a0
  3987. ; tst.b 24+8(a0)
  3988. ; bne end
  3989.   
  3990. ; JSR STOPTIMER
  3991.  
  3992.  
  3993.  bra lop
  3994.  
  3995.  
  3996.  
  3997. ; include "ab3:demo/system/keyboard.s"
  3998.  include "ab3:source_4000/ab3diipatchidr.s"
  3999.  
  4000. CLRTWOLINES:
  4001.  
  4002.  move.l d2,-(a7)
  4003.  
  4004.  moveq #0,d1
  4005.  move.w #7,d2
  4006. .ccc
  4007.  move.l d1,2(a0)
  4008.  move.l d1,6(a0)
  4009.  move.l d1,10(a0)
  4010.  move.l d1,14(a0)
  4011.  move.l d1,18(a0)
  4012.  move.l d1,22(a0)
  4013.  move.l d1,26(a0)
  4014.  move.l d1,30(a0)
  4015.  move.l d1,34(a0)
  4016.  move.l d1,2+40(a0)
  4017.  move.l d1,6+40(a0)
  4018.  move.l d1,10+40(a0)
  4019.  move.l d1,14+40(a0)
  4020.  move.l d1,18+40(a0)
  4021.  move.l d1,22+40(a0)
  4022.  move.l d1,26+40(a0)
  4023.  move.l d1,30+40(a0)
  4024.  move.l d1,34+40(a0)
  4025.  add.l #10240,a0
  4026.  dbra d2,.ccc
  4027.  move.l (a7)+,d2
  4028.  rts
  4029.  
  4030.  
  4031. LASTDH: dc.b 0
  4032. LASTDW: dc.b 0
  4033. WIDESCRN: dc.w 0
  4034. TRRANS: dc.w 0
  4035. DOANYWATER: dc.w 0
  4036.  
  4037. DoTheMapWotNastyCharlesIsForcingMeToDo:
  4038.  
  4039.  move.l TexturePal,a4
  4040.  add.l #256*32,a4
  4041. ; add.w MAPBRIGHT,a4
  4042.  
  4043.  move.l #KeyMap,a5
  4044.  tst.b $50(a5)
  4045.  beq.s .nobrighter
  4046.  tst.w MAPBRIGHT
  4047.  beq.s .nobrighter
  4048.  
  4049.  sub.w #1,MAPBRIGHT
  4050.  
  4051. .nobrighter:
  4052.  
  4053.  tst.b $51(a5)
  4054.  beq.s .nodimmer
  4055.  cmp.w #7,MAPBRIGHT
  4056.  bge.s .nodimmer
  4057.  
  4058.  add.w #1,MAPBRIGHT
  4059.  
  4060. .nodimmer:
  4061.  
  4062.  move.l #Rotated,a1
  4063.  move.l #COMPACTMAP,a2
  4064.  move.l #BIGMAP-40,a3
  4065.  
  4066. preshow:
  4067.  add.w #40,a3
  4068.  
  4069. SHOWMAP:
  4070.  move.l (a2)+,d5
  4071.  move.l a2,d7
  4072.  cmp.l LASTZONE,d7
  4073.  bgt shownmap
  4074.  
  4075.  tst.l d5
  4076.  beq.s preshow
  4077.  
  4078.  move.w #9,d7
  4079. wallsofzone
  4080.  
  4081.  asr.l #1,d5
  4082.  bcs.s WALLSEEN
  4083.  
  4084.  asr.l #1,d5
  4085.  bcs.s WALLMAPPED
  4086.  
  4087.  asr.l #1,d5
  4088.  addq #4,a3
  4089.  bra.s DECIDEDWALL
  4090.  
  4091. WALLMAPPED:
  4092.  move.w #$b00,d4
  4093.  asr.l #1,d5
  4094.  bcc.s .notadoor
  4095.  move.w #$e00,d4
  4096. .notadoor
  4097.  
  4098.  st TRRANS
  4099.  
  4100.  bra.s DECIDEDCOLOUR
  4101.  
  4102. WALLSEEN:
  4103.  
  4104.  clr.b TRRANS
  4105.  
  4106.  move.w #255,d4
  4107.  asr.l #2,d5
  4108.  bcc.s .notadoor
  4109.  move.w #254,d4
  4110. .notadoor
  4111. DECIDEDCOLOUR:
  4112.  move.w (a3)+,d6
  4113.  move.l (a1,d6.w*8),d0
  4114.  asr.l #7,d0
  4115.  movem.l d7/d5,-(a7)
  4116.  move.w mapxoff,d5
  4117.  ext.l d5
  4118.  add.l d5,d0
  4119.  move.l 4(a1,d6.w*8),d1
  4120.  move.w mapzoff,d5
  4121.  ext.l d5
  4122.  add.l d5,d1
  4123.  move.w (a3)+,d6
  4124.  move.l (a1,d6.w*8),d2
  4125.  move.w mapxoff,d5
  4126.  ext.l d5
  4127.  asr.l #7,d2
  4128.  add.l d5,d2
  4129.  move.l 4(a1,d6.w*8),d3
  4130.  move.w mapzoff,d5
  4131.  ext.l d5
  4132.  add.l d5,d3
  4133.  
  4134.  neg.l d1
  4135.  neg.l d3
  4136.  
  4137.  bsr CLIPANDDRAW
  4138.  movem.l (a7)+,d7/d5
  4139.  
  4140. DECIDEDWALL:
  4141.  
  4142.  dbra d7,wallsofzone
  4143.  bra SHOWMAP
  4144.  
  4145. shownmap:
  4146.  
  4147.  clr.b TRRANS
  4148.  
  4149.  move.w mapxoff,d0
  4150.  ext.l d0
  4151.  move.w mapzoff,d1
  4152.  ext.l d1
  4153.  neg.l d1
  4154.  move.l d0,d2
  4155.  move.l d1,d3
  4156.  sub.l #128,d1
  4157.  add.l #128,d3
  4158.  move.w #250,d4
  4159.  bsr CLIPANDDRAW
  4160.  
  4161.  move.w mapxoff,d0
  4162.  ext.l d0
  4163.  move.w mapzoff,d1
  4164.  ext.l d1
  4165.  neg.l d1
  4166.  move.l d0,d2
  4167.  move.l d1,d3
  4168.  sub.l #128,d1
  4169.  sub.l #32,d3
  4170.  sub.l #64,d2
  4171.  move.w #250,d4
  4172.  bsr CLIPANDDRAW
  4173.  
  4174.  move.w mapxoff,d0
  4175.  ext.l d0
  4176.  move.w mapzoff,d1
  4177.  ext.l d1
  4178.  neg.l d1
  4179.  move.l d0,d2
  4180.  move.l d1,d3
  4181.  sub.l #128,d1
  4182.  sub.l #32,d3
  4183.  add.l #64,d2
  4184.  move.w #250,d4
  4185.  bsr CLIPANDDRAW
  4186.  rts
  4187.  
  4188.  
  4189. CLIPANDDRAW:
  4190.  
  4191.  tst.b FULLSCR
  4192.  beq.s .nodov
  4193.  
  4194.  add.l d0,d0
  4195.  add.l d2,d2
  4196.  ext.l d0
  4197.  ext.l d2
  4198.  divs.l #3,d0
  4199.  divs.l #3,d2
  4200.  
  4201. .nodov:
  4202.  
  4203.  move.w MAPBRIGHT,d5
  4204.  
  4205.  asr.l d5,d0
  4206.  asr.l d5,d1
  4207.  asr.l d5,d2
  4208.  asr.l d5,d3
  4209.  
  4210. NOSCALING:
  4211.  add.l #96,d0
  4212.  bge p1xpos
  4213.  
  4214.  add.l #96,d2
  4215.  blt OFFSCREEN
  4216.  
  4217. x1nx2p:
  4218.  
  4219.  move.l d3,d5
  4220.  sub.l d1,d5
  4221.  move.l d2,d6
  4222.  sub.l d0,d6
  4223.  beq OFFSCREEN
  4224.  
  4225.  muls.l d0,d5
  4226.  divs.l d6,d5
  4227.  sub.l d5,d1
  4228.  move.l #0,d0
  4229.  
  4230.  bra doneleftclip
  4231.  
  4232. p1xpos:
  4233.  
  4234.  add.l #96,d2
  4235.  bge doneleftclip
  4236.  
  4237.  move.l d1,d5
  4238.  sub.l d3,d5
  4239.  move.l d0,d6
  4240.  sub.l d2,d6
  4241.  beq OFFSCREEN
  4242.  
  4243.  muls.l d2,d5
  4244.  divs.l d6,d5
  4245.  sub.l d5,d3
  4246.  move.l #0,d2
  4247.  
  4248. doneleftclip:
  4249.  
  4250.  cmp.l #191,d0
  4251.  ble p1xneg
  4252.  
  4253.  cmp.l #191,d2
  4254.  bgt OFFSCREEN
  4255.  
  4256.  move.l d0,d6
  4257.  sub.l d2,d6
  4258.  beq OFFSCREEN
  4259.  sub.l #191,d0
  4260.  move.l d3,d5
  4261.  sub.l d1,d5
  4262.  
  4263.  muls.l d5,d0
  4264.  divs.l d6,d0
  4265.  add.l d0,d1
  4266.  move.l #191,d0
  4267.  
  4268.  bra donerightclip
  4269.  
  4270. p1xneg:
  4271.  
  4272.  cmp.l #191,d2
  4273.  ble donerightclip
  4274.  
  4275.  move.l d2,d6
  4276.  sub.l d0,d6
  4277.  beq OFFSCREEN
  4278.  sub.l #191,d2
  4279.  move.l d1,d5
  4280.  sub.l d3,d5
  4281.  
  4282.  muls.l d5,d2
  4283.  divs.l d6,d2
  4284.  add.l d2,d3
  4285.  move.l #191,d2
  4286.  
  4287. donerightclip:
  4288.  
  4289. *********************************
  4290.  
  4291.  add.l #80,d1
  4292.  bge p1ypos
  4293.  
  4294.  add.l #80,d3
  4295.  blt OFFSCREEN
  4296.  
  4297.  move.l d2,d5
  4298.  sub.l d0,d5
  4299.  move.l d3,d6
  4300.  sub.l d1,d6
  4301.  beq OFFSCREEN
  4302.  
  4303.  muls.l d1,d5
  4304.  divs.l d6,d5
  4305.  sub.l d5,d0
  4306.  move.l #0,d1
  4307.  
  4308.  bra donetopclip
  4309.  
  4310. p1ypos:
  4311.  
  4312.  add.l #80,d3
  4313.  bge donetopclip
  4314.  
  4315.  move.l d0,d5
  4316.  sub.l d2,d5
  4317.  move.l d1,d6
  4318.  sub.l d3,d6
  4319.  beq OFFSCREEN
  4320.  
  4321.  muls.l d3,d5
  4322.  divs.l d6,d5
  4323.  sub.l d5,d2
  4324.  move.l #0,d3
  4325.  
  4326. donetopclip:
  4327.  
  4328.  cmp.l #159,d1
  4329.  ble p1yneg
  4330.  
  4331.  cmp.l #159,d3
  4332.  bgt OFFSCREEN
  4333.  
  4334.  move.l d1,d6
  4335.  sub.l d3,d6
  4336.  beq OFFSCREEN
  4337.  sub.l #159,d1
  4338.  move.l d2,d5
  4339.  sub.l d0,d5
  4340.  
  4341.  muls.l d5,d1
  4342.  divs.l d6,d1
  4343.  add.l d1,d0
  4344.  move.l #159,d1
  4345.  
  4346.  bra donebotclip
  4347.  
  4348. p1yneg:
  4349.  
  4350.  cmp.l #159,d3
  4351.  ble donebotclip
  4352.  
  4353.  move.l d3,d6
  4354.  sub.l d1,d6
  4355.  beq OFFSCREEN
  4356.  sub.l #159,d3
  4357.  move.l d0,d5
  4358.  sub.l d2,d5
  4359.  
  4360.  muls.l d5,d3
  4361.  divs.l d6,d3
  4362.  add.l d3,d2
  4363.  move.l #159,d3
  4364.  
  4365. donebotclip:
  4366.  
  4367.  tst.b TRRANS
  4368.  bne DRAWAtransLINE
  4369.  bra DRAWAMAPLINE
  4370.  
  4371. OFFSCREEN:
  4372. NOLINEtrans:
  4373.  rts
  4374.  
  4375. MAPBRIGHT:
  4376.  dc.w 3
  4377. mapxoff: dc.w 0
  4378. mapzoff: dc.w 0
  4379.  
  4380. DRAWAtransLINE:
  4381.  
  4382.  move.l FASTBUFFER,a0    ; screen to render to.
  4383.  
  4384.  tst.b FULLSCR
  4385.  beq.s .nooffset
  4386.   
  4387.  add.l #(320*40)+(48*2),a0
  4388.   
  4389. .nooffset:
  4390.  
  4391.  cmp.w d1,d3
  4392.  bgt.s .okdown
  4393.  bne.s .aline
  4394.  cmp.w d0,d2
  4395.  beq.s NOLINEtrans 
  4396. .aline
  4397.  exg d0,d2
  4398.  exg d1,d3
  4399. .okdown
  4400.  
  4401.  move.w d1,d5
  4402.  muls #320,d5
  4403.  add.l d5,a0
  4404.  lea (a0,d0.w*2),a0
  4405.  
  4406.  sub.w d1,d3
  4407.  
  4408.  sub.w d0,d2
  4409.  bge.s downrighttrans
  4410.  
  4411. downlefttrans:
  4412.  neg.w d2
  4413.  cmp.w d2,d3
  4414.  bgt.s downmorelefttrans
  4415.  
  4416. downleftmoretrans:
  4417.  move.w #320,d6
  4418.  move.w d2,d0
  4419.  move.w d2,d7
  4420.  
  4421. .linelop:
  4422.  move.b (a0),d4
  4423.  move.b (a4,d4.w*2),(a0)
  4424.  subq #1,a0
  4425.  sub.w d3,d0
  4426.  bgt.s .noextra
  4427.  add.w d2,d0
  4428.  add.w d6,a0
  4429. .noextra:
  4430.  dbra d7,.linelop
  4431.  rts
  4432.  
  4433. downmorelefttrans:
  4434.  move.w #320,d6
  4435.  move.w d3,d0
  4436.  move.w d3,d7
  4437.  
  4438. .linelop:
  4439.  move.b (a0),d4
  4440.  move.b (a4,d4.w*2),(a0)
  4441.  add.w d6,a0
  4442.  sub.w d2,d0
  4443.  bgt.s .noextra
  4444.  add.w d3,d0
  4445.  subq #1,a0
  4446. .noextra:
  4447.  dbra d7,.linelop
  4448.  
  4449.  rts
  4450.  
  4451. downrighttrans:
  4452.  
  4453.  cmp.w d2,d3
  4454.  bgt.s downmorerighttrans
  4455.  
  4456. downrightmoretrans:
  4457.  move.w #320,d6
  4458.  move.w d2,d0
  4459.  move.w d2,d7
  4460.  
  4461. .linelop:
  4462.  move.b (a0),d4
  4463.  move.b (a4,d4.w*2),(a0)+
  4464.  sub.w d3,d0
  4465.  bgt.s .noextra
  4466.  add.w d2,d0
  4467.  add.w d6,a0
  4468. .noextra:
  4469.  dbra d7,.linelop
  4470.  
  4471.  rts
  4472.  
  4473. downmorerighttrans:
  4474.  move.w #320,d6
  4475.  move.w d3,d0
  4476.  move.w d3,d7
  4477.  
  4478. .linelop:
  4479.  move.b (a0),d4
  4480.  move.b (a4,d4.w*2),(a0)
  4481.  add.w d6,a0
  4482.  sub.w d2,d0
  4483.  bgt.s .noextra
  4484.  add.w d3,d0
  4485.  addq #1,a0
  4486. .noextra:
  4487.  dbra d7,.linelop
  4488.  
  4489.  rts
  4490.  
  4491. NOLINE:
  4492.  rts
  4493.  
  4494. DRAWAMAPLINE:
  4495.  
  4496.  
  4497.  move.b DOUBLEHEIGHT,d5
  4498.  or.b DOUBLEWIDTH,d5
  4499.  tst.b d5
  4500.  bne DOITFAT
  4501.  
  4502.  move.l FASTBUFFER,a0    ; screen to render to.
  4503.  cmp.w d1,d3
  4504.  bgt.s .okdown
  4505.  bne.s .aline
  4506.  cmp.w d0,d2
  4507.  beq.s NOLINE 
  4508. .aline
  4509.  exg d0,d2
  4510.  exg d1,d3
  4511. .okdown
  4512.  
  4513.  move.w d1,d5
  4514.  muls #320,d5
  4515.  add.l d5,a0
  4516.  lea (a0,d0.w),a0
  4517.  
  4518.  sub.w d1,d3
  4519.  
  4520.  sub.w d0,d2
  4521.  bge.s downright
  4522.  
  4523. downleft:
  4524.  neg.w d2
  4525.  cmp.w d2,d3
  4526.  bgt.s downmoreleft
  4527.  
  4528. downleftmore:
  4529.  move.w #320,d6
  4530.  move.w d2,d0
  4531.  move.w d2,d7
  4532.  addq #1,a0
  4533.  
  4534. .linelop
  4535.  move.b d4,-(a0)
  4536.  sub.w d3,d0
  4537.  bgt.s .noextra
  4538.  add.w d2,d0
  4539.  add.w d6,a0
  4540. .noextra:
  4541.  dbra d7,.linelop
  4542.  rts
  4543.  
  4544. downmoreleft:
  4545.  move.w #320,d6
  4546.  move.w d3,d0
  4547.  move.w d3,d7
  4548.  
  4549. .linelop:
  4550.  move.b d4,(a0)
  4551.  add.w d6,a0
  4552.  sub.w d2,d0
  4553.  bgt.s .noextra
  4554.  add.w d3,d0
  4555.  subq #1,a0
  4556. .noextra:
  4557.  dbra d7,.linelop
  4558.  
  4559.  rts
  4560.  
  4561. downright:
  4562.  
  4563.  cmp.w d2,d3
  4564.  bgt.s downmoreright
  4565.  
  4566. downrightmore:
  4567.  move.w #320,d6
  4568.  move.w d2,d0
  4569.  move.w d2,d7
  4570.  
  4571. .linelop:
  4572.  move.b d4,(a0)+
  4573.  sub.w d3,d0
  4574.  bgt.s .noextra
  4575.  add.w d2,d0
  4576.  add.w d6,a0
  4577. .noextra:
  4578.  dbra d7,.linelop
  4579.  
  4580.  rts
  4581.  
  4582. downmoreright:
  4583.  move.w #320,d6
  4584.  move.w d3,d0
  4585.  move.w d3,d7
  4586.  
  4587. .linelop:
  4588.  move.b d4,(a0)
  4589.  add.w d6,a0
  4590.  sub.w d2,d0
  4591.  bgt.s .noextra
  4592.  add.w d3,d0
  4593.  addq #1,a0
  4594. .noextra:
  4595.  dbra d7,.linelop
  4596.  
  4597.  rts
  4598.  
  4599.  
  4600. DOITFAT:
  4601.  move.l FASTBUFFER,a0    ; screen to render to.
  4602.  cmp.w d1,d3
  4603.  bgt.s .okdown
  4604.  bne.s .aline
  4605.  cmp.w d0,d2
  4606.  beq NOLINE 
  4607. .aline
  4608.  exg d0,d2
  4609.  exg d1,d3
  4610. .okdown
  4611.  
  4612.  move.w d1,d5
  4613.  muls #320,d5
  4614.  add.l d5,a0
  4615.  lea (a0,d0.w),a0
  4616.  
  4617.  sub.w d1,d3
  4618.  
  4619.  sub.w d0,d2
  4620.  bge.s downrightFAT
  4621.  
  4622. downleftFAT:
  4623.  neg.w d2
  4624.  cmp.w d2,d3
  4625.  bgt.s downmoreleftFAT
  4626.  
  4627. downleftmoreFAT:
  4628.  move.w #320,d6
  4629.  move.w d2,d0
  4630.  move.w d2,d7
  4631.  addq #1,a0
  4632.  
  4633. .linelop
  4634.  move.b d4,319(a0)
  4635.  move.b d4,(a0)
  4636.  move.b d4,-(a0)
  4637.  sub.w d3,d0
  4638.  bgt.s .noextra
  4639.  add.w d2,d0
  4640.  add.w d6,a0
  4641. .noextra:
  4642.  dbra d7,.linelop
  4643.  rts
  4644.  
  4645. downmoreleftFAT:
  4646.  move.w #320,d6
  4647.  move.w d3,d0
  4648.  move.w d3,d7
  4649.  
  4650. .linelop:
  4651.  move.b d4,320(a0)
  4652.  move.b d4,1(a0)
  4653.  move.b d4,(a0)
  4654.  add.w d6,a0
  4655.  sub.w d2,d0
  4656.  bgt.s .noextra
  4657.  add.w d3,d0
  4658.  subq #1,a0
  4659. .noextra:
  4660.  dbra d7,.linelop
  4661.  
  4662.  rts
  4663.  
  4664. downrightFAT:
  4665.  
  4666.  cmp.w d2,d3
  4667.  bgt.s downmorerightFAT
  4668.  
  4669. downrightmoreFAT:
  4670.  move.w #320,d6
  4671.  move.w d2,d0
  4672.  move.w d2,d7
  4673.  
  4674. .linelop:
  4675.  move.b d4,320(a0)
  4676.  move.b d4,(a0)+
  4677.  move.b d4,(a0)
  4678.  sub.w d3,d0
  4679.  bgt.s .noextra
  4680.  add.w d2,d0
  4681.  add.w d6,a0
  4682. .noextra:
  4683.  dbra d7,.linelop
  4684.  
  4685.  rts
  4686.  
  4687. downmorerightFAT:
  4688.  move.w #320,d6
  4689.  move.w d3,d0
  4690.  move.w d3,d7
  4691.  
  4692. .linelop:
  4693.  move.b d4,320(a0)
  4694.  move.b d4,1(a0)
  4695.  move.b d4,(a0)
  4696.  add.w d6,a0
  4697.  sub.w d2,d0
  4698.  bgt.s .noextra
  4699.  add.w d3,d0
  4700.  addq #1,a0
  4701. .noextra:
  4702.  dbra d7,.linelop
  4703.  
  4704.  rts
  4705.  
  4706.  
  4707. SAVETHESCREEN:
  4708.  
  4709.  move.l old,$dff080
  4710.  move.w #$8020,$dff000+intena
  4711.  
  4712.  move.l _IntuitionBase,a6
  4713.  jsr _LVORethinkDisplay(a6)
  4714.  
  4715.  move.l doslib,a6
  4716.  move.l #SAVENAME,d1
  4717.  move.l #1006,d2
  4718.  jsr -30(a6)
  4719.  move.l d0,handle
  4720.  
  4721.  move.l doslib,a6
  4722.  move.l SCRNDRAWPT,d2
  4723.  move.l handle,d1
  4724.  move.l #10240*8,d3
  4725.  jsr _LVOWrite(a6)
  4726.  
  4727.  move.l doslib,a6
  4728.  move.l handle,d1
  4729.  jsr -36(a6)
  4730.  
  4731.  move.l doslib,a6
  4732.  move.l #200,d1
  4733.  jsr -198(a6) 
  4734.  
  4735.  move.w #$0020,$dff000+intena
  4736.  move.l #bigfield,$dff080
  4737.  
  4738.  add.b #1,SAVELETTER
  4739.  
  4740.  rts
  4741.  
  4742. SAVENAME: dc.b 'work:rawscrn'
  4743. SAVELETTER: dc.b 'd',0
  4744.  
  4745.  even
  4746.  
  4747.  include "ab3:source_4000/CHUNKY.s"
  4748.  
  4749.  
  4750. MASTERQUITTING: dc.b 0
  4751. SLAVEQUITTING: dc.b 0
  4752. MASTERPAUSE: dc.b 0
  4753. SLAVEPAUSE: dc.b 0
  4754.  
  4755. PAUSEOPTS:
  4756.  include "ab3:source_4000/pauseopts"
  4757.  
  4758. ENDZONE: dc.w 0
  4759.  
  4760. ENDZONES:
  4761. ; LEVEL 1
  4762.  dc.w -1
  4763. ; dc.w 55
  4764. ; LEVEL 2
  4765.  dc.w 149
  4766. ; LEVEL 3
  4767.  dc.w 155
  4768. ; LEVEL 4
  4769.  dc.w 107
  4770. ; LEVEL 5
  4771.  dc.w 67
  4772. ; LEVEL 6
  4773.  dc.w 132
  4774. ; LEVEL 7
  4775.  dc.w 203
  4776. ; LEVEL 8
  4777.  dc.w 166
  4778. ; LEVEL 9
  4779.  dc.w 118
  4780. ; LEVEL 10
  4781.  dc.w 102
  4782. ; LEVEL 11
  4783.  dc.w 103
  4784. ; LEVEL 12
  4785.  dc.w 2
  4786. ; LEVEL 13
  4787.  dc.w 98
  4788. ; LEVEL 14
  4789.  dc.w 0
  4790. ; LEVEL 15
  4791.  dc.w 148
  4792. ; LEVEL 16
  4793.  dc.w 103
  4794.  
  4795. ***************************************************************************
  4796. ***************************************************************************
  4797. ****************** End of Main Loop here ********************************** 
  4798. ***************************************************************************
  4799. ***************************************************************************
  4800.  
  4801. putinsmallscr:
  4802.  
  4803.  rts
  4804.  
  4805.  move.l #$1fe0000,statskip
  4806.  move.l #$1fe0000,statskip+4
  4807.  
  4808.  move.l #healthpal,a5
  4809. ; move.l COPSCRN1,a0
  4810. ; move.l COPSCRN2,a2
  4811.  move.w #scrheight-1,d0
  4812.  move.l #0,d6
  4813.  move.w #0,d3
  4814.  move.w #$2bdf,startwait
  4815.  move.w #$2d01,endwait
  4816. .fillcop
  4817.  move.w #$180,d1
  4818.  
  4819.  move.l a0,a1
  4820.  move.l a2,a3
  4821.  move.w #$10c,(a1)+
  4822.  move.w #$10c,(a3)+
  4823.  move.w d3,(a1)+
  4824.  move.w d3,(a3)+
  4825.  eor.w #$8000,d3
  4826.  
  4827.  move.w #$106,(a1)+
  4828.  move.w #$106,(a3)+
  4829.  move.w #$2c42,d5
  4830.  or.w d3,d5
  4831.  and.w #$fffe,d5
  4832.  move.w d5,(a1)+
  4833.  move.w d5,(a3)+
  4834.  bsr do32
  4835.  
  4836.  move.w #$106,(a1)+
  4837.  move.w #$106,(a3)+
  4838.  move.w #$4c42,d5
  4839.  or.w d3,d5
  4840.  and.w #$fffe,d5
  4841.  move.w d5,(a1)+
  4842.  move.w d5,(a3)+
  4843.  bsr do32
  4844.  
  4845.  move.w #$106,(a1)+
  4846.  move.w #$106,(a3)+
  4847.  move.w #$6c42,d5
  4848.  or.w d3,d5
  4849.  and.w #$fffe,d5
  4850.  move.w d5,(a1)+
  4851.  move.w d5,(a3)+
  4852.  bsr do32
  4853.  
  4854.  
  4855.  move.l #$1060c42,(a1)+
  4856.  move.l #$1060c42,(a3)+
  4857.  move.w #$19e,(a1)+
  4858.  move.w (a5),(a1)+
  4859.  move.w #$19e,(a3)+
  4860.  move.w (a5)+,(a3)+
  4861.  
  4862. **********************************
  4863.  
  4864.  adda.w #104*4,a0
  4865.  adda.w #104*4,a2
  4866.  dbra d0,.fillcop
  4867.  
  4868.  move.w #$48,fetchstart
  4869.  move.w #$88,fetchstop
  4870.  move.w #$2cb1,winstart
  4871.  move.w #$2c91,winstop
  4872.  move.w #-24,modulo
  4873.  move.w #-24,modulo+4
  4874.  
  4875.  move.l #nullspr,d0
  4876.  move.w d0,s4l
  4877.  move.w d0,s5l
  4878.  move.w d0,s6l
  4879.  move.w d0,s7l
  4880.  swap d0
  4881.  move.w d0,s4h
  4882.  move.w d0,s5h
  4883.  move.w d0,s6h
  4884.  move.w d0,s7h 
  4885.  
  4886. ; move.l #borders,d0
  4887. ; move.w d0,s0l
  4888. ; swap d0
  4889. ; move.w d0,s0h
  4890. ; move.l #borders+2592,d0
  4891. ; move.w d0,s1l
  4892. ; swap d0
  4893. ; move.w d0,s1h
  4894. ; move.l #borders+2592*2,d0
  4895. ; move.w d0,s2l
  4896. ; swap d0
  4897. ; move.w d0,s2h
  4898. ; move.l #borders+2592*3,d0
  4899. ; move.w d0,s3l
  4900. ; swap d0
  4901. ; move.w d0,s3h
  4902.  
  4903.  
  4904.  move.l scrn,a0
  4905.  add.l #40,a0
  4906.  move.l scrn,a1
  4907.  add.l #160,a1
  4908.  move.l scrn,a2
  4909.  add.l #280,a2
  4910.  move.l #smallscrntab,a3
  4911.  move.w #191,d7    ; counter
  4912.  move.w #0,d1    ; xpos
  4913. .plotscrnloop:
  4914.  move.b (a3)+,d0
  4915.  move.w d1,d2
  4916.  asr.w #3,d2
  4917.  move.b d1,d3
  4918.  not.b d3
  4919.  bclr.b d3,-40(a0,d2.w)
  4920.  bclr.b d3,(a0,d2.w)
  4921.  bclr.b d3,40(a0,d2.w)
  4922.  bclr.b d3,-40(a1,d2.w)
  4923.  bclr.b d3,(a1,d2.w)
  4924.  bclr.b d3,40(a1,d2.w)
  4925.  bclr.b d3,-40(a2,d2.w)
  4926.  btst #0,d0
  4927.  beq.s .nobp1
  4928.  bset.b d3,-40(a0,d2.w)
  4929. .nobp1:
  4930.  btst #1,d0
  4931.  beq.s .nobp2
  4932.  bset.b d3,(a0,d2.w)
  4933. .nobp2:
  4934.  btst #2,d0
  4935.  beq.s .nobp3
  4936.  bset.b d3,40(a0,d2.w)
  4937. .nobp3:
  4938.  btst #3,d0
  4939.  beq.s .nobp4
  4940.  bset.b d3,-40(a1,d2.w)
  4941. .nobp4:
  4942.  btst #4,d0
  4943.  beq.s .nobp5
  4944.  bset.b d3,(a1,d2.w)
  4945. .nobp5:
  4946.  btst #5,d0
  4947.  beq.s .nobp6
  4948.  bset.b d3,40(a1,d2.w)
  4949. .nobp6:
  4950.  btst #6,d0
  4951.  beq.s .nobp7
  4952.  bset.b d3,-40(a2,d2.w)
  4953. .nobp7:
  4954.  
  4955.  addq #1,d1
  4956.  
  4957.  dbra d7,.plotscrnloop
  4958.  
  4959.  
  4960.  rts
  4961.  
  4962. putinlargescr:
  4963.  
  4964.  move.l #$1000000,statskip
  4965.  move.l #$fffffffe,statskip+4
  4966.  
  4967.  move.l #healthpal,a5
  4968. ; move.l COPSCRN1,a0
  4969. ; move.l COPSCRN2,a2
  4970.  move.w #scrheight-1,d0
  4971.  move.l #0,d6
  4972.  move.w #0,d3
  4973.  move.w #$29df,startwait
  4974.  move.w #$2b01,endwait
  4975. .fillcop
  4976.  move.w #$180,d1
  4977.  
  4978.  move.l a0,a1
  4979.  move.l a2,a3
  4980.  move.w #$10c,(a1)+
  4981.  move.w #$10c,(a3)+
  4982.  move.w d3,(a1)+
  4983.  move.w d3,(a3)+
  4984.  eor.w #$8000,d3
  4985.  
  4986.  move.w #$106,(a1)+
  4987.  move.w #$106,(a3)+
  4988.  move.w #$2c42,d5
  4989.  or.w d3,d5
  4990.  and.w #$fffe,d5
  4991.  move.w d5,(a1)+
  4992.  move.w d5,(a3)+
  4993.  bsr do32
  4994.  
  4995.  move.w #$106,(a1)+
  4996.  move.w #$106,(a3)+
  4997.  move.w #$4c42,d5
  4998.  or.w d3,d5
  4999.  and.w #$fffe,d5
  5000.  move.w d5,(a1)+
  5001.  move.w d5,(a3)+
  5002.  bsr do32
  5003.  
  5004.  move.w #$106,(a1)+
  5005.  move.w #$106,(a3)+
  5006.  move.w #$6c42,d5
  5007.  or.w d3,d5
  5008.  and.w #$fffe,d5
  5009.  move.w d5,(a1)+
  5010.  move.w d5,(a3)+
  5011.  bsr do32
  5012.  
  5013.  move.w startwait,(a1)+
  5014.  move.w #$fffe,(a1)+
  5015.  move.w endwait,(a1)+
  5016.  move.w #$ff00,(a1)+
  5017.  move.w startwait,(a3)+
  5018.  move.w #$fffe,(a3)+
  5019.  move.w endwait,(a3)+
  5020.  move.w #$ff00,(a3)+
  5021.  
  5022. ; move.l $1fe0000,(a1)+
  5023. ; move.l $1fe0000,(a3)+
  5024. ; move.l $1fe0000,(a1)+
  5025. ; move.l $1fe0000,(a3)+
  5026.  
  5027.  
  5028.  add.w #$300,startwait
  5029.  add.w #$300,endwait
  5030.  
  5031. ; move.l #$1060c42,(a1)+
  5032. ; move.l #$1060c42,(a3)+
  5033. ; move.w #$19e,(a1)+
  5034. ; move.w (a5),(a1)+
  5035. ; move.w #$19e,(a3)+
  5036. ; move.w (a5)+,(a3)+
  5037.  
  5038. **********************************
  5039.  
  5040.  adda.w #104*4,a0
  5041.  adda.w #104*4,a2
  5042.  dbra d0,.fillcop
  5043.  
  5044.  move.w #$38,fetchstart
  5045.  move.w #$b8,fetchstop
  5046.  move.w #$2c81,winstart
  5047.  move.w #$2cc1,winstop
  5048.  move.w #-40,modulo
  5049.  move.w #-40,modulo+4
  5050.  
  5051.  move.l #nullspr,d0
  5052.  move.w d0,s0l
  5053.  move.w d0,s1l
  5054.  move.w d0,s2l
  5055.  move.w d0,s3l
  5056.  move.w d0,s4l
  5057.  move.w d0,s5l
  5058.  move.w d0,s6l
  5059.  move.w d0,s7l
  5060.  swap d0
  5061.  move.w d0,s0h
  5062.  move.w d0,s1h
  5063.  move.w d0,s2h
  5064.  move.w d0,s3h
  5065.  move.w d0,s4h
  5066.  move.w d0,s5h
  5067.  move.w d0,s6h
  5068.  move.w d0,s7h 
  5069.  
  5070.  move.l scrn,a0
  5071.  move.l a0,a1
  5072.  move.l a0,a2
  5073.  add.l #40,a0
  5074.  add.l #160,a1
  5075.  add.l #280,a2
  5076.  move.l #scrntab,a3
  5077.  move.w #319,d7    ; counter
  5078.  move.w #0,d1    ; xpos
  5079. .plotscrnloop:
  5080.  move.b (a3)+,d0
  5081.  move.w d1,d2
  5082.  asr.w #3,d2
  5083.  move.b d1,d3
  5084.  not.b d3
  5085.  bclr.b d3,-40(a0,d2.w)
  5086.  bclr.b d3,(a0,d2.w)
  5087.  bclr.b d3,40(a0,d2.w)
  5088.  bclr.b d3,-40(a1,d2.w)
  5089.  bclr.b d3,(a1,d2.w)
  5090.  bclr.b d3,40(a1,d2.w)
  5091.  bclr.b d3,-40(a2,d2.w)
  5092.  btst #0,d0
  5093.  beq.s .nobp1
  5094.  bset.b d3,-40(a0,d2.w)
  5095. .nobp1:
  5096.  btst #1,d0
  5097.  beq.s .nobp2
  5098.  bset.b d3,(a0,d2.w)
  5099. .nobp2:
  5100.  btst #2,d0
  5101.  beq.s .nobp3
  5102.  bset.b d3,40(a0,d2.w)
  5103. .nobp3:
  5104.  btst #3,d0
  5105.  beq.s .nobp4
  5106.  bset.b d3,-40(a1,d2.w)
  5107. .nobp4:
  5108.  btst #4,d0
  5109.  beq.s .nobp5
  5110.  bset.b d3,(a1,d2.w)
  5111. .nobp5:
  5112.  btst #5,d0
  5113.  beq.s .nobp6
  5114.  bset.b d3,40(a1,d2.w)
  5115. .nobp6:
  5116.  btst #6,d0
  5117.  beq.s .nobp7
  5118.  bset.b d3,-40(a2,d2.w)
  5119. .nobp7:
  5120.  
  5121.  addq #1,d1
  5122.  
  5123.  dbra d7,.plotscrnloop
  5124.  
  5125.  rts
  5126.  
  5127. CLEARKEYBOARD:
  5128.  move.l #KeyMap,a5
  5129.  moveq #0,d0
  5130.  move.w #15,d1
  5131. clrloo:
  5132.  move.l d0,(a5)+
  5133.  move.l d0,(a5)+
  5134.  move.l d0,(a5)+
  5135.  move.l d0,(a5)+
  5136.  dbra d1,clrloo
  5137.  rts
  5138.  
  5139. READCONTROLS: dc.w 0
  5140.  
  5141. tstststst: dc.w 0
  5142.  
  5143. BollocksRoom:
  5144.  dc.w -1
  5145.  ds.l 50
  5146.  
  5147. GUNYOFFS:
  5148.  dc.w 20
  5149.  dc.w 20
  5150.  dc.w 0
  5151.  dc.w 20
  5152.  dc.w 20
  5153.  dc.w 0
  5154.  dc.w 0
  5155.  dc.w 20
  5156.  
  5157. PLR1_BOBBLEY: dc.l 0
  5158. PLR2_BOBBLEY: dc.l 0
  5159.  
  5160. IVEWONTEXT:
  5161. ;      12345678901234567890123456789012345678901234567890123456789012345678901234567890
  5162.  dc.b 'Player 1 Bites the dust!                '
  5163.  dc.b '                                        '
  5164.  dc.b 'Player 1 Bites the dust!                '
  5165.  dc.b '                                        '
  5166.  
  5167.  dc.b 'Player 2 has kicked the bucket!         '
  5168.  dc.b '                                        '
  5169.  dc.b 'Player 2 has kicked the bucket!         '
  5170.  dc.b '                                        '
  5171.  
  5172.  
  5173.  dc.b 'Player 3 is history!                    '
  5174.  dc.b '                                        '
  5175.  dc.b 'Player 3 is history!                    '
  5176.  dc.b '                                        '
  5177.  
  5178.  
  5179.  dc.b 'Enemy Player Vanquished!                '
  5180.  dc.b '                                        '
  5181.  dc.b 'Enemy Player Vanquished!                '
  5182.  dc.b '                                        '
  5183.  
  5184.  dc.b 'Oooh, that one must have hurt!          '
  5185.  dc.b '                                        '
  5186.  dc.b 'Oooh, that one must have hurt!          '
  5187.  dc.b '                                        '
  5188.  
  5189.  dc.b 'Opponent IS toast!                      '
  5190.  dc.b '                                        '
  5191.  dc.b 'Opponent IS toast!                      '
  5192.  dc.b '                                        '
  5193.  
  5194.  dc.b 'Does it hurt? DOES it? DOES IT?!?       '
  5195.  dc.b '                                        '
  5196.  dc.b 'Does it hurt? DOES it? DOES IT?!?       '
  5197.  dc.b '                                        '
  5198.  
  5199.  dc.b "Gosh, I",39,"m dreadfully sorry, old chap; didn't see you there!                     "
  5200.  dc.b "Gosh, I",39,"m dreadfully sorry, old chap; didn't see you there!                     "
  5201.  
  5202.  dc.b 'Now go away before I taunt you a second time.                                   '
  5203.  dc.b 'Now go away before I taunt you a second time.                                   '
  5204.  
  5205.  dc.b 'Eh, sorry about that there mate, didn',39,'t know it was loaded, know worra mean?    '
  5206.  dc.b 'Eh, sorry about that there mate, didn',39,'t know it was loaded, know worra mean?    '
  5207.  
  5208.  dc.b 'Stand and deliver, your money or...  oh. Never mind.                            ' 
  5209.  dc.b 'Stand and deliver, your money or...  oh. Never mind.                            '
  5210.  
  5211.  dc.b 'Thank you for your kind interest, I look forward to your custom in future lives.' 
  5212.  dc.b 'Thank you for your kind interest, I look forward to your custom in future lives.' 
  5213.  
  5214.  
  5215. USEPLR1:
  5216.  
  5217. ***********************************
  5218.  
  5219.  move.l PLR1_Obj,a0 
  5220.  move.b #4,16(a0)
  5221.  move.l ObjectPoints,a1
  5222.  move.l #ObjRotated,a2
  5223.  move.w (a0),d0
  5224.  move.l PLR1_xoff,(a1,d0.w*8)
  5225.  move.l PLR1_zoff,4(a1,d0.w*8)
  5226.  move.l PLR1_Roompt,a1
  5227.  
  5228.  moveq #0,d2
  5229.  move.b damagetaken(a0),d2
  5230.  beq .notbeenshot
  5231.  
  5232.  moveq #0,d4
  5233.  move.w ImpactX(a0),d3
  5234.  beq.s .notwist
  5235.  move.w d2,d4
  5236. .notwist:
  5237.  add.w d3,PLR1s_xspdval
  5238.  move.w ImpactZ(a0),d3
  5239.  beq.s .notwist2
  5240.  move.w d2,d4
  5241. .notwist2:
  5242.  add.w d3,PLR1s_zspdval
  5243.  move.w ImpactY(a0),d3
  5244.  ext.l d3
  5245.  asl.l #8,d3
  5246.  add.l d3,PLR1s_yvel
  5247.  
  5248.  move.w #0,ImpactX(a0)
  5249.  move.w #0,ImpactY(a0)
  5250.  move.w #0,ImpactZ(a0)
  5251.  
  5252.  jsr GetRand
  5253.  muls d4,d0
  5254.  asr.l #8,d0
  5255.  asr.l #4,d0
  5256.  add.w d0,PLR1s_angspd
  5257.  
  5258.  move.l #7*2116,hitcol
  5259.  sub.w d2,PLAYERONEHEALTH
  5260.  movem.l d0-d7/a0-a6,-(a7)
  5261.  move.w #$fffa,IDNUM
  5262.  move.w #19,Samplenum
  5263.  clr.b notifplaying
  5264.  move.w #0,Noisex
  5265.  move.w #0,Noisez
  5266.  move.w #60,Noisevol
  5267.  jsr MakeSomeNoise
  5268.  
  5269.  movem.l (a7)+,d0-d7/a0-a6
  5270.  
  5271. .notbeenshot
  5272.  move.b #0,damagetaken(a0)
  5273.  move.b #10,numlives(a0)
  5274.  
  5275.  move.w p1_angpos,Facing(a0)
  5276.  move.b PLR1_StoodInTop,ObjInTop(a0)
  5277.  
  5278.  move.w (a1),12(a0)
  5279.  move.w (a1),d2
  5280.  move.l #ZoneBrightTable,a1
  5281.  move.l (a1,d2.w*4),d2
  5282.  tst.b PLR1_StoodInTop
  5283.  bne.s .okinbott
  5284.  swap d2
  5285. .okinbott:
  5286.  
  5287.  move.w d2,2(a0)
  5288.  
  5289.  
  5290.  move.l p1_yoff,d0
  5291.  move.l p1_height,d1
  5292.  asr.l #1,d1
  5293.  add.l d1,d0
  5294.  asr.l #7,d0
  5295.  move.w d0,4(a0)
  5296.  
  5297.  tst.w PLAYERONEHEALTH
  5298.  bgt.s .okh1
  5299.  move.w #-1,12(a0)
  5300. .okh1:
  5301.  
  5302.  
  5303. ***********************************
  5304.  
  5305.  move.l PLR2_Obj,a0 
  5306.  move.b #5,16(a0)
  5307.  
  5308.  move.w p2_angpos,d0
  5309.  and.w #8190,d0
  5310.  move.w d0,Facing(a0)
  5311. ; jsr ViewpointToDraw
  5312. ; asl.w #2,d0
  5313. ; moveq #0,d1
  5314. ; move.b p2_bobble,d1
  5315. ; not.b d1
  5316. ; lsr.b #3,d1
  5317. ; and.b #$3,d1
  5318. ; add.w d1,d0
  5319. ; move.w d0,10(a0)
  5320. ; move.w #10,8(a0)
  5321.  
  5322.  move.l ObjectPoints,a1
  5323.  move.l #ObjRotated,a2
  5324.  move.w (a0),d0
  5325.  move.l PLR2_xoff,(a1,d0.w*8)
  5326.  move.l PLR2_zoff,4(a1,d0.w*8)
  5327.  move.l PLR2_Roompt,a1
  5328.  
  5329.  moveq #0,d2
  5330.  move.b damagetaken(a0),d2
  5331.  beq .notbeenshot2
  5332.  move.w ImpactX(a0),d3
  5333.  add.w d3,PLR2s_xspdval
  5334.  move.w ImpactZ(a0),d3
  5335.  add.w d3,PLR2s_zspdval
  5336.  move.w ImpactY(a0),d3
  5337.  ext.l d3
  5338.  asl.l #8,d3
  5339.  add.l d3,PLR2s_yvel
  5340.  
  5341.  move.w #0,ImpactX(a0)
  5342.  move.w #0,ImpactY(a0)
  5343.  move.w #0,ImpactZ(a0)
  5344.  
  5345.  sub.w d2,PLAYERTWOHEALTH
  5346.  
  5347.  
  5348. .notbeenshot2
  5349.  move.b #0,damagetaken(a0)
  5350.  move.b #10,numlives(a0)
  5351.  
  5352.  move.b PLR2_StoodInTop,ObjInTop(a0)
  5353.  
  5354.  move.w (a1),12(a0)
  5355.  move.w (a1),d2
  5356.  move.l #ZoneBrightTable,a1
  5357.  move.l (a1,d2.w*4),d2
  5358.  tst.b PLR2_StoodInTop
  5359.  bne.s .okinbott2
  5360.  swap d2
  5361. .okinbott2:
  5362.  
  5363.  move.w d2,2(a0)
  5364.  
  5365.  move.l p2_yoff,d0
  5366.  move.l p2_height,d1
  5367.  asr.l #1,d1
  5368.  add.l d1,d0
  5369.  asr.l #7,d0
  5370.  move.w d0,4(a0)
  5371.  
  5372.  jsr ViewpointToDraw
  5373.  add.l d0,d0
  5374.  
  5375.  move.l LINKFILE,a6
  5376.  add.l #PLR2ALIEN,a6
  5377.  move.w (a6),d7
  5378.  move.w d7,d1
  5379.  
  5380.  move.l LINKFILE,a6
  5381.  add.l #AlienStats,a6
  5382.  muls #AlienStatLen,d1
  5383.  add.l d1,a6
  5384.  move.b A_GFXType+1(a6),VECOBJ
  5385.  cmp.w #1,A_GFXType(a6)
  5386.  bne.s .NOSIDES2
  5387.  
  5388.  moveq #0,d0
  5389.  
  5390. .NOSIDES2:
  5391.  
  5392.  move.l LINKFILE,a6
  5393.  
  5394.  add.l #AlienAnimData,a6
  5395.  
  5396.  move.w d7,d1
  5397.  muls #A_AnimLen,d1
  5398.  add.l d1,a6
  5399.  
  5400. ; move.l ANIMPOINTER,a6
  5401.  
  5402.  muls #A_OptLen,d0
  5403.  add.w d0,a6
  5404.  
  5405.  move.w SecTimer(a0),d1
  5406.  move.w d1,d2
  5407.  muls #A_FrameLen,d1
  5408.  
  5409.  addq #1,d2
  5410.  
  5411.  move.w d2,d3
  5412.  muls #A_FrameLen,d3
  5413.  tst.b (a6,d3.w)
  5414.  bge.s .noendanim
  5415.  move.w #0,d2
  5416. .noendanim
  5417.  move.w d2,SecTimer(a0)
  5418.  
  5419.  move.w d2,d1
  5420.  
  5421.  muls #A_FrameLen,d1
  5422.  
  5423.  move.l #0,8(a0)
  5424.  move.b (a6,d1.w),9(a0)
  5425.  move.b 1(a6,d1.w),d0
  5426.  ext.w d0
  5427.  bgt.s .noflip
  5428.  move.b #128,10(a0)
  5429.  neg.w d0
  5430. .noflip:
  5431.  sub.w #1,d0
  5432.  move.b d0,11(a0)
  5433.  
  5434.  move.w #-1,6(a0)
  5435.  cmp.b #1,VECOBJ
  5436.  beq.s .nosize
  5437.  bgt.s .setlight
  5438.  move.w 2(a6,d1.w),6(a0)
  5439.  bra.s .ddone
  5440.  
  5441. .nosize
  5442.  
  5443. ; move.l #$00090001,8(a0)
  5444.  
  5445.  bra.s .ddone
  5446.  
  5447. .setlight:
  5448.  move.w 2(a6,d1.w),6(a0)
  5449.  
  5450.  move.b VECOBJ,d1
  5451.  or.b d1,10(a0)
  5452.  
  5453. .ddone:
  5454.  
  5455.  
  5456.  tst.w PLAYERTWOHEALTH
  5457.  bgt.s .okh
  5458.  move.w #-1,12(a0)
  5459. .okh:
  5460.  
  5461.  
  5462. **********************************
  5463.  
  5464.  
  5465.  move.l PLR3_Obj,a0 
  5466.  move.b #6,16(a0)
  5467.  
  5468.  move.w p3_angpos,d0
  5469.  and.w #8190,d0
  5470.  move.w d0,Facing(a0)
  5471. ; jsr ViewpointToDraw
  5472. ; asl.w #2,d0
  5473. ; moveq #0,d1
  5474. ; move.b p2_bobble,d1
  5475. ; not.b d1
  5476. ; lsr.b #3,d1
  5477. ; and.b #$3,d1
  5478. ; add.w d1,d0
  5479. ; move.w d0,10(a0)
  5480. ; move.w #10,8(a0)
  5481.  
  5482.  move.l ObjectPoints,a1
  5483.  move.l #ObjRotated,a2
  5484.  move.w (a0),d0
  5485.  move.l PLR3_xoff,(a1,d0.w*8)
  5486.  move.l PLR3_zoff,4(a1,d0.w*8)
  5487.  move.l PLR3_Roompt,a1
  5488.  
  5489.  moveq #0,d2
  5490.  move.b damagetaken(a0),d2
  5491.  beq .notbeenshot3
  5492.  move.w ImpactX(a0),d3
  5493.  add.w d3,PLR3s_xspdval
  5494.  move.w ImpactZ(a0),d3
  5495.  add.w d3,PLR3s_zspdval
  5496.  move.w ImpactY(a0),d3
  5497.  ext.l d3
  5498.  asl.l #8,d3
  5499.  add.l d3,PLR3s_yvel
  5500.  
  5501.  move.w #0,ImpactX(a0)
  5502.  move.w #0,ImpactY(a0)
  5503.  move.w #0,ImpactZ(a0)
  5504.  
  5505.  sub.w d2,PLAYERTHREEHEALTH
  5506.  
  5507.  
  5508. .notbeenshot3
  5509.  move.b #0,damagetaken(a0)
  5510.  move.b #10,numlives(a0)
  5511.  
  5512.  move.b PLR3_StoodInTop,ObjInTop(a0)
  5513.  
  5514.  move.w (a1),12(a0)
  5515.  move.w (a1),d2
  5516.  move.l #ZoneBrightTable,a1
  5517.  move.l (a1,d2.w*4),d2
  5518.  tst.b PLR3_StoodInTop
  5519.  bne.s .okinbott3
  5520.  swap d2
  5521. .okinbott3:
  5522.  
  5523.  move.w d2,2(a0)
  5524.  
  5525.  move.l p3_yoff,d0
  5526.  move.l p3_height,d1
  5527.  asr.l #1,d1
  5528.  add.l d1,d0
  5529.  asr.l #7,d0
  5530.  move.w d0,4(a0)
  5531.  
  5532.  jsr ViewpointToDraw
  5533.  add.l d0,d0
  5534.  
  5535.  move.l LINKFILE,a6
  5536.  add.l #PLR1ALIEN,a6
  5537.  move.w (a6),d7
  5538.  move.w d7,d1
  5539.  
  5540.  move.l LINKFILE,a6
  5541.  add.l #AlienStats,a6
  5542.  muls #AlienStatLen,d1
  5543.  add.l d1,a6
  5544.  move.b A_GFXType+1(a6),VECOBJ
  5545.  cmp.w #1,A_GFXType(a6)
  5546.  bne.s .NOSIDES3
  5547.  
  5548.  moveq #0,d0
  5549.  
  5550. .NOSIDES3:
  5551.  
  5552.  move.l LINKFILE,a6
  5553.  
  5554.  add.l #AlienAnimData,a6
  5555.  
  5556.  move.w d7,d1
  5557.  muls #A_AnimLen,d1
  5558.  add.l d1,a6
  5559.  
  5560. ; move.l ANIMPOINTER,a6
  5561.  
  5562.  muls #A_OptLen,d0
  5563.  add.w d0,a6
  5564.  
  5565.  move.w SecTimer(a0),d1
  5566.  move.w d1,d2
  5567.  muls #A_FrameLen,d1
  5568.  
  5569.  addq #1,d2
  5570.  
  5571.  move.w d2,d3
  5572.  muls #A_FrameLen,d3
  5573.  tst.b (a6,d3.w)
  5574.  bge.s .noendanim3
  5575.  move.w #0,d2
  5576. .noendanim3
  5577.  move.w d2,SecTimer(a0)
  5578.  
  5579.  move.w d2,d1
  5580.  
  5581.  muls #A_FrameLen,d1
  5582.  
  5583.  move.l #0,8(a0)
  5584.  move.b (a6,d1.w),9(a0)
  5585.  move.b 1(a6,d1.w),d0
  5586.  ext.w d0
  5587.  bgt.s .noflip3
  5588.  move.b #128,10(a0)
  5589.  neg.w d0
  5590. .noflip3:
  5591.  sub.w #1,d0
  5592.  move.b d0,11(a0)
  5593.  
  5594.  move.w #-1,6(a0)
  5595.  cmp.b #1,VECOBJ
  5596.  beq.s .nosize3
  5597.  bgt.s .setlight3
  5598.  move.w 2(a6,d1.w),6(a0)
  5599.  bra.s .ddone3
  5600.  
  5601. .nosize3
  5602.  
  5603. ; move.l #$00090001,8(a0)
  5604.  
  5605.  bra.s .ddone3
  5606.  
  5607. .setlight3:
  5608.  move.w 2(a6,d1.w),6(a0)
  5609.  
  5610.  move.b VECOBJ,d1
  5611.  or.b d1,10(a0)
  5612.  
  5613. .ddone3:
  5614.  
  5615.  
  5616.  tst.w PLAYERTHREEHEALTH
  5617.  bgt.s .okh3
  5618.  move.w #-1,12(a0)
  5619. .okh3:
  5620.  
  5621. **********************************
  5622.  
  5623.  
  5624.  move.l PLR1_Obj,a0
  5625.  move.l GUN_OBJ,a3
  5626.  
  5627.  ifeq CHEESEY
  5628.  
  5629.  tst.w PLAYERONEHEALTH
  5630.  bgt.s .notdead
  5631.  
  5632.  move.w #-1,12(a3)
  5633.  rts
  5634.  
  5635. .notdead: 
  5636.  
  5637.  move.l PLR1_Roompt,a1
  5638.  
  5639.  move.w Facing(a0),d0
  5640.  add.w #4096,d0
  5641.  and.w #8190,d0
  5642.  move.w d0,Facing(a3)
  5643.  
  5644.  move.w (a1),12(a3)
  5645.  move.w (a1),GraphicRoom(a3)
  5646.  
  5647.  moveq #0,d0
  5648.  move.b p1_gunselected,d0
  5649.  
  5650.  move.l LINKFILE,a1
  5651.  add.l #GunObjects,a1
  5652.  move.w (a1,d0.w*2),d0
  5653.  
  5654.  move.b d0,TypeOfThing(a3)
  5655.  move.b #1,128(a3)
  5656.  
  5657.  move.w (a0),d0
  5658.  move.w (a3),d1
  5659.  move.l ObjectPoints,a1
  5660.  move.l (a1,d0.w*8),(a1,d1.w*8)
  5661.  move.l 4(a1,d0.w*8),4(a1,d1.w*8)
  5662.  
  5663.  st WhichAnim(a3)
  5664.  
  5665.  move.l p1_yoff,d0
  5666.  move.l p1_height,d1
  5667.  asr.l #2,d1
  5668.  add.l #10*128,d1
  5669.  add.l d1,d0
  5670.  asr.l #7,d0
  5671.  move.w d0,4(a3)
  5672.  move.l PLR1_BOBBLEY,d1
  5673.  asr.l #8,d1
  5674.  move.l d1,d0
  5675.  asr.l #1,d0
  5676.  add.l d0,d1
  5677.  add.w d1,4(a3)
  5678.  
  5679.  move.b ObjInTop(a0),ObjInTop(a3)
  5680.  
  5681.  endc
  5682.  
  5683.  ifne CHEESEY
  5684.  move.w #-1,12+128(a0)
  5685.  endc
  5686.  
  5687.  rts
  5688.  
  5689. ***************************************************
  5690. **************************************************
  5691.  
  5692. USEPLR2:
  5693.  
  5694. ***********************************
  5695.  
  5696.  move.l PLR2_Obj,a0 
  5697.  move.b #5,16(a0)
  5698.  move.l ObjectPoints,a1
  5699.  move.l #ObjRotated,a2
  5700.  move.w (a0),d0
  5701.  move.l PLR2_xoff,(a1,d0.w*8)
  5702.  move.l PLR2_zoff,4(a1,d0.w*8)
  5703.  move.l PLR2_Roompt,a1
  5704.  
  5705.  moveq #0,d2
  5706.  move.b damagetaken(a0),d2
  5707.  beq .notbeenshot
  5708.  
  5709.  moveq #0,d4
  5710.  move.w ImpactX(a0),d3
  5711.  beq.s .notwist
  5712.  move.w d2,d4
  5713. .notwist:
  5714.  add.w d3,PLR2s_xspdval
  5715.  move.w ImpactZ(a0),d3
  5716.  beq.s .notwist2
  5717.  move.w d2,d4
  5718. .notwist2:
  5719.  add.w d3,PLR2s_zspdval
  5720.  
  5721.  jsr GetRand
  5722.  muls d4,d0
  5723.  asr.l #8,d0
  5724.  asr.l #4,d0
  5725.  add.w d0,PLR2s_angspd
  5726.  
  5727.  move.l #7*2116,hitcol
  5728.  sub.w d2,PLAYERTWOHEALTH
  5729.  
  5730.  
  5731.  movem.l d0-d7/a0-a6,-(a7)
  5732.  move.w #19,Samplenum
  5733.  clr.b notifplaying
  5734.  move.w #$fffa,IDNUM
  5735.  move.w #0,Noisex
  5736.  move.w #0,Noisez
  5737.  move.w #60,Noisevol
  5738.  jsr MakeSomeNoise
  5739.  
  5740.  movem.l (a7)+,d0-d7/a0-a6
  5741.  
  5742. .notbeenshot
  5743.  move.b #0,damagetaken(a0)
  5744.  move.b #10,numlives(a0)
  5745.  
  5746.  move.w p2_angpos,Facing(a0)
  5747.  move.b PLR2_StoodInTop,ObjInTop(a0)
  5748.  
  5749.  move.w (a1),12(a0)
  5750.  move.w (a1),d2
  5751.  move.l #ZoneBrightTable,a1
  5752.  move.l (a1,d2.w*4),d2
  5753.  tst.b PLR2_StoodInTop
  5754.  bne.s .okinbott
  5755.  swap d2
  5756. .okinbott:
  5757.  
  5758.  move.w d2,2(a0)
  5759.  
  5760.  move.l PLR2_yoff,d0
  5761.  move.l p2_height,d1
  5762.  asr.l #1,d1
  5763.  add.l d1,d0
  5764.  asr.l #7,d0
  5765.  move.w d0,4(a0)
  5766.  
  5767.  tst.w PLAYERTWOHEALTH
  5768.  bgt.s .okh55
  5769.  move.w #-1,12(a0)
  5770. .okh55:
  5771.  
  5772. ***********************************
  5773.  
  5774.  move.l PLR1_Obj,a0 
  5775.  move.b #4,16(a0)
  5776.  
  5777.  move.w PLR1_angpos,d0
  5778.  and.w #8190,d0
  5779.  move.w d0,Facing(a0)
  5780. ; jsr ViewpointToDraw
  5781. ; asl.w #2,d0
  5782. ; moveq #0,d1
  5783. ; move.b p2_bobble,d1
  5784. ; not.b d1
  5785. ; lsr.b #3,d1
  5786. ; and.b #$3,d1
  5787. ; add.w d1,d0
  5788. ; move.w d0,10(a0)
  5789. ; move.w #10,8(a0)
  5790.  
  5791.  move.l ObjectPoints,a1
  5792.  move.l #ObjRotated,a2
  5793.  move.w (a0),d0
  5794.  move.l PLR1_xoff,(a1,d0.w*8)
  5795.  move.l PLR1_zoff,4(a1,d0.w*8)
  5796.  move.l PLR1_Roompt,a1
  5797.  
  5798.  moveq #0,d2
  5799.  move.b damagetaken(a0),d2
  5800.  beq .notbeenshot2
  5801.  
  5802.  move.w ImpactX(a0),d3
  5803.  add.w d3,PLR1s_xspdval
  5804.  move.w ImpactZ(a0),d3
  5805.  add.w d3,PLR1s_zspdval
  5806.  
  5807.  sub.w d2,PLAYERONEHEALTH
  5808.  
  5809.  
  5810. .notbeenshot2
  5811.  move.b #0,damagetaken(a0)
  5812.  move.b #10,numlives(a0)
  5813.  
  5814.  move.b PLR1_StoodInTop,ObjInTop(a0)
  5815.  
  5816.  move.w (a1),12(a0)
  5817.  move.w (a1),d2
  5818.  move.l #ZoneBrightTable,a1
  5819.  move.l (a1,d2.w*4),d2
  5820.  tst.b PLR1_StoodInTop
  5821.  bne.s .okinbott2
  5822.  swap d2
  5823. .okinbott2:
  5824.  
  5825.  move.w d2,2(a0)
  5826.  
  5827.  move.l p1_yoff,d0
  5828.  move.l p1_height,d1
  5829.  asr.l #1,d1
  5830.  add.l d1,d0
  5831.  asr.l #7,d0
  5832.  move.w d0,4(a0)
  5833.  
  5834.  jsr ViewpointToDraw
  5835.  add.l d0,d0
  5836.  
  5837.  move.l LINKFILE,a6
  5838.  add.l #PLR1ALIEN,a6
  5839.  move.w (a6),d7
  5840.  move.w d7,d1
  5841.  
  5842.  move.l LINKFILE,a6
  5843.  add.l #AlienStats,a6
  5844.  muls #AlienStatLen,d1
  5845.  add.l d1,a6
  5846.  move.b A_GFXType+1(a6),VECOBJ
  5847.  cmp.w #1,A_GFXType(a6)
  5848.  bne.s .NOSIDES2
  5849.  
  5850.  moveq #0,d0
  5851.  
  5852. .NOSIDES2:
  5853.  
  5854.  move.l LINKFILE,a6
  5855.  
  5856.  add.l #AlienAnimData,a6
  5857.  
  5858.  move.w d7,d1
  5859.  muls #A_AnimLen,d1
  5860.  add.l d1,a6
  5861.  
  5862. ; move.l ANIMPOINTER,a6
  5863.  
  5864.  muls #A_OptLen,d0
  5865.  add.w d0,a6
  5866.  
  5867.  move.w SecTimer(a0),d1
  5868.  move.w d1,d2
  5869.  muls #A_FrameLen,d1
  5870.  
  5871.  addq #1,d2
  5872.  
  5873.  move.w d2,d3
  5874.  muls #A_FrameLen,d3
  5875.  tst.b (a6,d3.w)
  5876.  bge.s .noendanim
  5877.  move.w #0,d2
  5878. .noendanim
  5879.  move.w d2,SecTimer(a0)
  5880.  
  5881.  move.w d2,d1
  5882.  
  5883.  muls #A_FrameLen,d1
  5884.  
  5885.  move.l #0,8(a0)
  5886.  move.b (a6,d1.w),9(a0)
  5887.  move.b 1(a6,d1.w),d0
  5888.  ext.w d0
  5889.  bgt.s .noflip
  5890.  move.b #128,10(a0)
  5891.  neg.w d0
  5892. .noflip:
  5893.  sub.w #1,d0
  5894.  move.b d0,11(a0)
  5895.  
  5896.  move.w #-1,6(a0)
  5897.  cmp.b #1,VECOBJ
  5898.  beq.s .nosize
  5899.  bgt.s .setlight
  5900.  move.w 2(a6,d1.w),6(a0)
  5901.  bra.s .ddone
  5902.  
  5903. .nosize
  5904.  
  5905. ; move.l #$00090001,8(a0)
  5906.  
  5907.  bra.s .ddone
  5908.  
  5909. .setlight:
  5910.  move.w 2(a6,d1.w),6(a0)
  5911.  
  5912.  move.b VECOBJ,d1
  5913.  or.b d1,10(a0)
  5914.  
  5915. .ddone:
  5916.  
  5917.  tst.w PLAYERONEHEALTH
  5918.  bgt.s .okh
  5919.  move.w #-1,12(a0)
  5920. .okh:
  5921.  
  5922. **********************************
  5923.  
  5924.  
  5925.  move.l PLR3_Obj,a0 
  5926.  move.b #3,16(a0)
  5927.  
  5928.  move.w p3_angpos,d0
  5929.  and.w #8190,d0
  5930.  move.w d0,Facing(a0)
  5931. ; jsr ViewpointToDraw
  5932. ; asl.w #2,d0
  5933. ; moveq #0,d1
  5934. ; move.b p2_bobble,d1
  5935. ; not.b d1
  5936. ; lsr.b #3,d1
  5937. ; and.b #$3,d1
  5938. ; add.w d1,d0
  5939. ; move.w d0,10(a0)
  5940. ; move.w #10,8(a0)
  5941.  
  5942.  move.l ObjectPoints,a1
  5943.  move.l #ObjRotated,a2
  5944.  move.w (a0),d0
  5945.  move.l PLR3_xoff,(a1,d0.w*8)
  5946.  move.l PLR3_zoff,4(a1,d0.w*8)
  5947.  move.l PLR3_Roompt,a1
  5948.  
  5949.  moveq #0,d2
  5950.  move.b damagetaken(a0),d2
  5951.  beq .notbeenshot3
  5952.  move.w ImpactX(a0),d3
  5953.  add.w d3,PLR3s_xspdval
  5954.  move.w ImpactZ(a0),d3
  5955.  add.w d3,PLR3s_zspdval
  5956.  move.w ImpactY(a0),d3
  5957.  ext.l d3
  5958.  asl.l #8,d3
  5959.  add.l d3,PLR3s_yvel
  5960.  
  5961.  move.w #0,ImpactX(a0)
  5962.  move.w #0,ImpactY(a0)
  5963.  move.w #0,ImpactZ(a0)
  5964.  
  5965.  sub.w d2,PLAYERTHREEHEALTH
  5966.  
  5967.  
  5968. .notbeenshot3
  5969.  move.b #0,damagetaken(a0)
  5970.  move.b #10,numlives(a0)
  5971.  
  5972.  move.b PLR3_StoodInTop,ObjInTop(a0)
  5973.  
  5974.  move.w (a1),12(a0)
  5975.  move.w (a1),d2
  5976.  move.l #ZoneBrightTable,a1
  5977.  move.l (a1,d2.w*4),d2
  5978.  tst.b PLR3_StoodInTop
  5979.  bne.s .okinbott3
  5980.  swap d2
  5981. .okinbott3:
  5982.  
  5983.  move.w d2,2(a0)
  5984.  
  5985.  move.l p3_yoff,d0
  5986.  move.l p3_height,d1
  5987.  asr.l #1,d1
  5988.  add.l d1,d0
  5989.  asr.l #7,d0
  5990.  move.w d0,4(a0)
  5991.  
  5992.  jsr ViewpointToDraw
  5993.  add.l d0,d0
  5994.  
  5995.  move.l LINKFILE,a6
  5996.  add.l #PLR1ALIEN,a6
  5997.  move.w (a6),d7
  5998.  move.w d7,d1
  5999.  
  6000.  move.l LINKFILE,a6
  6001.  add.l #AlienStats,a6
  6002.  muls #AlienStatLen,d1
  6003.  add.l d1,a6
  6004.  move.b A_GFXType+1(a6),VECOBJ
  6005.  cmp.w #1,A_GFXType(a6)
  6006.  bne.s .NOSIDES3
  6007.  
  6008.  moveq #0,d0
  6009.  
  6010. .NOSIDES3:
  6011.  
  6012.  move.l LINKFILE,a6
  6013.  
  6014.  add.l #AlienAnimData,a6
  6015.  
  6016.  move.w d7,d1
  6017.  muls #A_AnimLen,d1
  6018.  add.l d1,a6
  6019.  
  6020. ; move.l ANIMPOINTER,a6
  6021.  
  6022.  muls #A_OptLen,d0
  6023.  add.w d0,a6
  6024.  
  6025.  move.w SecTimer(a0),d1
  6026.  move.w d1,d2
  6027.  muls #A_FrameLen,d1
  6028.  
  6029.  addq #1,d2
  6030.  
  6031.  move.w d2,d3
  6032.  muls #A_FrameLen,d3
  6033.  tst.b (a6,d3.w)
  6034.  bge.s .noendanim3
  6035.  move.w #0,d2
  6036. .noendanim3
  6037.  move.w d2,SecTimer(a0)
  6038.  
  6039.  move.w d2,d1
  6040.  
  6041.  muls #A_FrameLen,d1
  6042.  
  6043.  move.l #0,8(a0)
  6044.  move.b (a6,d1.w),9(a0)
  6045.  move.b 1(a6,d1.w),d0
  6046.  ext.w d0
  6047.  bgt.s .noflip3
  6048.  move.b #128,10(a0)
  6049.  neg.w d0
  6050. .noflip3:
  6051.  sub.w #1,d0
  6052.  move.b d0,11(a0)
  6053.  
  6054.  move.w #-1,6(a0)
  6055.  cmp.b #1,VECOBJ
  6056.  beq.s .nosize3
  6057.  bgt.s .setlight3
  6058.  move.w 2(a6,d1.w),6(a0)
  6059.  bra.s .ddone3
  6060.  
  6061. .nosize3
  6062.  
  6063. ; move.l #$00090001,8(a0)
  6064.  
  6065.  bra.s .ddone3
  6066.  
  6067. .setlight3:
  6068.  move.w 2(a6,d1.w),6(a0)
  6069.  
  6070.  move.b VECOBJ,d1
  6071.  or.b d1,10(a0)
  6072.  
  6073. .ddone3:
  6074.  
  6075.  
  6076.  tst.w PLAYERTHREEHEALTH
  6077.  bgt.s .okh3
  6078.  move.w #-1,12(a0)
  6079. .okh3:
  6080.  
  6081. **********************************
  6082.  
  6083. **********************************
  6084.  
  6085.  move.l PLR2_Obj,a0
  6086.  move.l GUN_OBJ,a3
  6087.  
  6088.  ifeq CHEESEY
  6089.  
  6090.  tst.w PLAYERTWOHEALTH
  6091.  bgt.s .notdead
  6092.  
  6093.  move.w #-1,12(a3)
  6094.  rts
  6095.  
  6096. .notdead: 
  6097.  move.l PLR2_Roompt,a1
  6098.  
  6099.  move.w Facing(a0),d0
  6100.  add.w #4096,d0
  6101.  and.w #8190,d0
  6102.  move.w d0,Facing(a3)
  6103.  
  6104.  move.w (a1),12(a3)
  6105.  move.w (a1),GraphicRoom(a3)
  6106.  
  6107.  moveq #0,d0
  6108.  move.b p2_gunselected,d0
  6109.  
  6110.  move.l LINKFILE,a1
  6111.  add.l #GunObjects,a1
  6112.  move.w (a1,d0.w*2),d0
  6113.  
  6114.  move.b d0,TypeOfThing(a3)
  6115.  move.b #1,16(a3)
  6116.  
  6117.  move.w (a0),d0
  6118.  move.w (a3),d1
  6119.  move.l ObjectPoints,a1
  6120.  move.l (a1,d0.w*8),(a1,d1.w*8) 
  6121.  move.l 4(a1,d0.w*8),4(a1,d1.w*8) 
  6122.  
  6123.  st WhichAnim(a3)
  6124.  
  6125.  move.l p2_yoff,d0
  6126.  move.l p2_height,d1
  6127.  asr.l #2,d1
  6128.  add.l #10*128,d1
  6129.  add.l d1,d0
  6130.  asr.l #7,d0
  6131.  move.w d0,4(a3)
  6132.  move.l PLR2_BOBBLEY,d1
  6133.  asr.l #8,d1
  6134.  move.l d1,d0
  6135.  asr.l #1,d0
  6136.  add.l d0,d1
  6137.  add.w d1,4(a3)
  6138.  
  6139.  move.b ObjInTop(a0),ObjInTop(a3)
  6140.  
  6141.  endc
  6142.  
  6143.  ifne CHEESEY
  6144.  
  6145.  move.w #-1,12(a3)
  6146.  endc
  6147.  
  6148.  rts
  6149.  
  6150.  
  6151. USEPLR3:
  6152.  
  6153. ***********************************
  6154.  
  6155.  move.l PLR3_Obj,a0 
  6156.  move.b #3,16(a0)
  6157.  move.l ObjectPoints,a1
  6158.  move.l #ObjRotated,a2
  6159.  move.w (a0),d0
  6160.  move.l PLR3_xoff,(a1,d0.w*8)
  6161.  move.l PLR3_zoff,4(a1,d0.w*8)
  6162.  move.l PLR3_Roompt,a1
  6163.  
  6164.  moveq #0,d2
  6165.  move.b damagetaken(a0),d2
  6166.  beq .notbeenshot
  6167.  
  6168.  moveq #0,d4
  6169.  move.w ImpactX(a0),d3
  6170.  beq.s .notwist
  6171.  move.w d2,d4
  6172. .notwist:
  6173.  add.w d3,PLR3s_xspdval
  6174.  move.w ImpactZ(a0),d3
  6175.  beq.s .notwist2
  6176.  move.w d2,d4
  6177. .notwist2:
  6178.  add.w d3,PLR3s_zspdval
  6179.  
  6180.  jsr GetRand
  6181.  muls d4,d0
  6182.  asr.l #8,d0
  6183.  asr.l #4,d0
  6184.  add.w d0,PLR3s_angspd
  6185.  
  6186.  move.l #7*2116,hitcol
  6187.  sub.w d2,PLAYERTHREEHEALTH
  6188.  
  6189.  
  6190.  movem.l d0-d7/a0-a6,-(a7)
  6191.  move.w #19,Samplenum
  6192.  clr.b notifplaying
  6193.  move.w #$fffa,IDNUM
  6194.  move.w #0,Noisex
  6195.  move.w #0,Noisez
  6196.  move.w #60,Noisevol
  6197.  jsr MakeSomeNoise
  6198.  
  6199.  movem.l (a7)+,d0-d7/a0-a6
  6200.  
  6201. .notbeenshot
  6202.  move.b #0,damagetaken(a0)
  6203.  move.b #10,numlives(a0)
  6204.  
  6205.  move.w p3_angpos,Facing(a0)
  6206.  move.b PLR3_StoodInTop,ObjInTop(a0)
  6207.  
  6208.  move.w (a1),12(a0)
  6209.  move.w (a1),d2
  6210.  move.l #ZoneBrightTable,a1
  6211.  move.l (a1,d2.w*4),d2
  6212.  tst.b PLR3_StoodInTop
  6213.  bne.s .okinbott
  6214.  swap d2
  6215. .okinbott:
  6216.  
  6217.  move.w d2,2(a0)
  6218.  
  6219.  move.l PLR3_yoff,d0
  6220.  move.l p3_height,d1
  6221.  asr.l #1,d1
  6222.  add.l d1,d0
  6223.  asr.l #7,d0
  6224.  move.w d0,4(a0)
  6225.  
  6226.  tst.w PLAYERTHREEHEALTH
  6227.  bgt.s .okh55
  6228.  move.w #-1,12(a0)
  6229. .okh55:
  6230.  
  6231. ***********************************
  6232.  
  6233. ***********************************
  6234.  
  6235.  move.l PLR2_Obj,a0 
  6236.  move.b #5,16(a0)
  6237.  
  6238.  move.w p2_angpos,d0
  6239.  and.w #8190,d0
  6240.  move.w d0,Facing(a0)
  6241. ; jsr ViewpointToDraw
  6242. ; asl.w #2,d0
  6243. ; moveq #0,d1
  6244. ; move.b p2_bobble,d1
  6245. ; not.b d1
  6246. ; lsr.b #3,d1
  6247. ; and.b #$3,d1
  6248. ; add.w d1,d0
  6249. ; move.w d0,10(a0)
  6250. ; move.w #10,8(a0)
  6251.  
  6252.  move.l ObjectPoints,a1
  6253.  move.l #ObjRotated,a2
  6254.  move.w (a0),d0
  6255.  move.l PLR2_xoff,(a1,d0.w*8)
  6256.  move.l PLR2_zoff,4(a1,d0.w*8)
  6257.  move.l PLR2_Roompt,a1
  6258.  
  6259.  moveq #0,d2
  6260.  move.b damagetaken(a0),d2
  6261.  beq .notbeenshot2
  6262.  move.w ImpactX(a0),d3
  6263.  add.w d3,PLR2s_xspdval
  6264.  move.w ImpactZ(a0),d3
  6265.  add.w d3,PLR2s_zspdval
  6266.  move.w ImpactY(a0),d3
  6267.  ext.l d3
  6268.  asl.l #8,d3
  6269.  add.l d3,PLR2s_yvel
  6270.  
  6271.  move.w #0,ImpactX(a0)
  6272.  move.w #0,ImpactY(a0)
  6273.  move.w #0,ImpactZ(a0)
  6274.  
  6275.  sub.w d2,PLAYERTWOHEALTH
  6276.  
  6277.  
  6278. .notbeenshot2
  6279.  move.b #0,damagetaken(a0)
  6280.  move.b #10,numlives(a0)
  6281.  
  6282.  move.b PLR2_StoodInTop,ObjInTop(a0)
  6283.  
  6284.  move.w (a1),12(a0)
  6285.  move.w (a1),d2
  6286.  move.l #ZoneBrightTable,a1
  6287.  move.l (a1,d2.w*4),d2
  6288.  tst.b PLR2_StoodInTop
  6289.  bne.s .okinbott2
  6290.  swap d2
  6291. .okinbott2:
  6292.  
  6293.  move.w d2,2(a0)
  6294.  
  6295.  move.l p2_yoff,d0
  6296.  move.l p2_height,d1
  6297.  asr.l #1,d1
  6298.  add.l d1,d0
  6299.  asr.l #7,d0
  6300.  move.w d0,4(a0)
  6301.  
  6302.  jsr ViewpointToDraw
  6303.  add.l d0,d0
  6304.  
  6305.  move.l LINKFILE,a6
  6306.  add.l #PLR2ALIEN,a6
  6307.  move.w (a6),d7
  6308.  move.w d7,d1
  6309.  
  6310.  move.l LINKFILE,a6
  6311.  add.l #AlienStats,a6
  6312.  muls #AlienStatLen,d1
  6313.  add.l d1,a6
  6314.  move.b A_GFXType+1(a6),VECOBJ
  6315.  cmp.w #1,A_GFXType(a6)
  6316.  bne.s .NOSIDES2
  6317.  
  6318.  moveq #0,d0
  6319.  
  6320. .NOSIDES2:
  6321.  
  6322.  move.l LINKFILE,a6
  6323.  
  6324.  add.l #AlienAnimData,a6
  6325.  
  6326.  move.w d7,d1
  6327.  muls #A_AnimLen,d1
  6328.  add.l d1,a6
  6329.  
  6330. ; move.l ANIMPOINTER,a6
  6331.  
  6332.  muls #A_OptLen,d0
  6333.  add.w d0,a6
  6334.  
  6335.  move.w SecTimer(a0),d1
  6336.  move.w d1,d2
  6337.  muls #A_FrameLen,d1
  6338.  
  6339.  addq #1,d2
  6340.  
  6341.  move.w d2,d3
  6342.  muls #A_FrameLen,d3
  6343.  tst.b (a6,d3.w)
  6344.  bge.s .noendanim
  6345.  move.w #0,d2
  6346. .noendanim
  6347.  move.w d2,SecTimer(a0)
  6348.  
  6349.  move.w d2,d1
  6350.  
  6351.  muls #A_FrameLen,d1
  6352.  
  6353.  move.l #0,8(a0)
  6354.  move.b (a6,d1.w),9(a0)
  6355.  move.b 1(a6,d1.w),d0
  6356.  ext.w d0
  6357.  bgt.s .noflip
  6358.  move.b #128,10(a0)
  6359.  neg.w d0
  6360. .noflip:
  6361.  sub.w #1,d0
  6362.  move.b d0,11(a0)
  6363.  
  6364.  move.w #-1,6(a0)
  6365.  cmp.b #1,VECOBJ
  6366.  beq.s .nosize
  6367.  bgt.s .setlight
  6368.  move.w 2(a6,d1.w),6(a0)
  6369.  bra.s .ddone
  6370.  
  6371. .nosize
  6372.  
  6373. ; move.l #$00090001,8(a0)
  6374.  
  6375.  bra.s .ddone
  6376.  
  6377. .setlight:
  6378.  move.w 2(a6,d1.w),6(a0)
  6379.  
  6380.  move.b VECOBJ,d1
  6381.  or.b d1,10(a0)
  6382.  
  6383. .ddone:
  6384.  
  6385.  
  6386.  tst.w PLAYERTWOHEALTH
  6387.  bgt.s .okh
  6388.  move.w #-1,12(a0)
  6389. .okh:
  6390.  
  6391.  
  6392. **********************************
  6393.  
  6394.  
  6395. ***********************************
  6396.  
  6397.  move.l PLR1_Obj,a0 
  6398.  move.b #4,16(a0)
  6399.  
  6400.  move.w PLR1_angpos,d0
  6401.  and.w #8190,d0
  6402.  move.w d0,Facing(a0)
  6403. ; jsr ViewpointToDraw
  6404. ; asl.w #2,d0
  6405. ; moveq #0,d1
  6406. ; move.b p2_bobble,d1
  6407. ; not.b d1
  6408. ; lsr.b #3,d1
  6409. ; and.b #$3,d1
  6410. ; add.w d1,d0
  6411. ; move.w d0,10(a0)
  6412. ; move.w #10,8(a0)
  6413.  
  6414.  move.l ObjectPoints,a1
  6415.  move.l #ObjRotated,a2
  6416.  move.w (a0),d0
  6417.  move.l PLR1_xoff,(a1,d0.w*8)
  6418.  move.l PLR1_zoff,4(a1,d0.w*8)
  6419.  move.l PLR1_Roompt,a1
  6420.  
  6421.  moveq #0,d2
  6422.  move.b damagetaken(a0),d2
  6423.  beq .notbeenshot233
  6424.  
  6425.  move.w ImpactX(a0),d3
  6426.  add.w d3,PLR1s_xspdval
  6427.  move.w ImpactZ(a0),d3
  6428.  add.w d3,PLR1s_zspdval
  6429.  
  6430.  sub.w d2,PLAYERONEHEALTH
  6431.  
  6432.  
  6433. .notbeenshot233
  6434.  move.b #0,damagetaken(a0)
  6435.  move.b #10,numlives(a0)
  6436.  
  6437.  move.b PLR1_StoodInTop,ObjInTop(a0)
  6438.  
  6439.  move.w (a1),12(a0)
  6440.  move.w (a1),d2
  6441.  move.l #ZoneBrightTable,a1
  6442.  move.l (a1,d2.w*4),d2
  6443.  tst.b PLR1_StoodInTop
  6444.  bne.s .okinbott233
  6445.  swap d2
  6446. .okinbott233:
  6447.  
  6448.  move.w d2,2(a0)
  6449.  
  6450.  move.l p1_yoff,d0
  6451.  move.l p1_height,d1
  6452.  asr.l #1,d1
  6453.  add.l d1,d0
  6454.  asr.l #7,d0
  6455.  move.w d0,4(a0)
  6456.  
  6457.  jsr ViewpointToDraw
  6458.  add.l d0,d0
  6459.  
  6460.  move.l LINKFILE,a6
  6461.  add.l #PLR1ALIEN,a6
  6462.  move.w (a6),d7
  6463.  move.w d7,d1
  6464.  
  6465.  move.l LINKFILE,a6
  6466.  add.l #AlienStats,a6
  6467.  muls #AlienStatLen,d1
  6468.  add.l d1,a6
  6469.  move.b A_GFXType+1(a6),VECOBJ
  6470.  cmp.w #1,A_GFXType(a6)
  6471.  bne.s .NOSIDES233
  6472.  
  6473.  moveq #0,d0
  6474.  
  6475. .NOSIDES233:
  6476.  
  6477.  move.l LINKFILE,a6
  6478.  
  6479.  add.l #AlienAnimData,a6
  6480.  
  6481.  move.w d7,d1
  6482.  muls #A_AnimLen,d1
  6483.  add.l d1,a6
  6484.  
  6485. ; move.l ANIMPOINTER,a6
  6486.  
  6487.  muls #A_OptLen,d0
  6488.  add.w d0,a6
  6489.  
  6490.  move.w SecTimer(a0),d1
  6491.  move.w d1,d2
  6492.  muls #A_FrameLen,d1
  6493.  
  6494.  addq #1,d2
  6495.  
  6496.  move.w d2,d3
  6497.  muls #A_FrameLen,d3
  6498.  tst.b (a6,d3.w)
  6499.  bge.s .noendanim33
  6500.  move.w #0,d2
  6501. .noendanim33
  6502.  move.w d2,SecTimer(a0)
  6503.  
  6504.  move.w d2,d1
  6505.  
  6506.  muls #A_FrameLen,d1
  6507.  
  6508.  move.l #0,8(a0)
  6509.  move.b (a6,d1.w),9(a0)
  6510.  move.b 1(a6,d1.w),d0
  6511.  ext.w d0
  6512.  bgt.s .noflip33
  6513.  move.b #128,10(a0)
  6514.  neg.w d0
  6515. .noflip33:
  6516.  sub.w #1,d0
  6517.  move.b d0,11(a0)
  6518.  
  6519.  move.w #-1,6(a0)
  6520.  cmp.b #1,VECOBJ
  6521.  beq.s .nosize33
  6522.  bgt.s .setlight33
  6523.  move.w 2(a6,d1.w),6(a0)
  6524.  bra.s .ddone33
  6525.  
  6526. .nosize33
  6527.  
  6528. ; move.l #$00090001,8(a0)
  6529.  
  6530.  bra.s .ddone33
  6531.  
  6532. .setlight33:
  6533.  move.w 2(a6,d1.w),6(a0)
  6534.  
  6535.  move.b VECOBJ,d1
  6536.  or.b d1,10(a0)
  6537.  
  6538. .ddone33:
  6539.  
  6540.  tst.w PLAYERONEHEALTH
  6541.  bgt.s .okh33
  6542.  move.w #-1,12(a0)
  6543. .okh33:
  6544.  
  6545. **********************************
  6546.  
  6547.  
  6548.  
  6549. **********************************
  6550.  
  6551.  move.l PLR3_Obj,a0
  6552.  move.l GUN_OBJ,a3
  6553.  
  6554.  ifeq CHEESEY
  6555.  
  6556.  tst.w PLAYERTWOHEALTH
  6557.  bgt.s .notdead
  6558.  
  6559.  move.w #-1,12(a3)
  6560.  rts
  6561.  
  6562. .notdead: 
  6563.  move.l PLR3_Roompt,a1
  6564.  
  6565.  move.w Facing(a0),d0
  6566.  add.w #4096,d0
  6567.  and.w #8190,d0
  6568.  move.w d0,Facing(a3)
  6569.  
  6570.  move.w (a1),12(a3)
  6571.  move.w (a1),GraphicRoom(a3)
  6572.  
  6573.  moveq #0,d0
  6574.  move.b p3_gunselected,d0
  6575.  
  6576.  move.l LINKFILE,a1
  6577.  add.l #GunObjects,a1
  6578.  move.w (a1,d0.w*2),d0
  6579.  
  6580.  move.b d0,TypeOfThing(a3)
  6581.  move.b #1,16(a3)
  6582.  
  6583.  move.w (a0),d0
  6584.  move.w (a3),d1
  6585.  move.l ObjectPoints,a1
  6586.  move.l (a1,d0.w*8),(a1,d1.w*8) 
  6587.  move.l 4(a1,d0.w*8),4(a1,d1.w*8) 
  6588.  
  6589.  st WhichAnim(a3)
  6590.  
  6591.  move.l p3_yoff,d0
  6592.  move.l p3_height,d1
  6593.  asr.l #2,d1
  6594.  add.l #10*128,d1
  6595.  add.l d1,d0
  6596.  asr.l #7,d0
  6597.  move.w d0,4(a3)
  6598.  move.l PLR3_BOBBLEY,d1
  6599.  asr.l #8,d1
  6600.  move.l d1,d0
  6601.  asr.l #1,d0
  6602.  add.l d0,d1
  6603.  add.w d1,4(a3)
  6604.  
  6605.  move.b ObjInTop(a0),ObjInTop(a3)
  6606.  
  6607.  endc
  6608.  
  6609.  ifne CHEESEY
  6610.  
  6611.  move.w #-1,12(a3)
  6612.  endc
  6613.  
  6614. **********************************
  6615.  
  6616.  move.l PLR3_Obj,a0
  6617.  move.l GUN_OBJ,a3
  6618.  
  6619.  ifeq CHEESEY
  6620.  
  6621.  tst.w PLAYERTHREEHEALTH
  6622.  bgt.s .notdead333
  6623.  
  6624.  move.w #-1,12(a3)
  6625.  rts
  6626.  
  6627. .notdead333: 
  6628.  move.l PLR3_Roompt,a1
  6629.  
  6630.  move.w Facing(a0),d0
  6631.  add.w #4096,d0
  6632.  and.w #8190,d0
  6633.  move.w d0,Facing(a3)
  6634.  
  6635.  move.w (a1),12(a3)
  6636.  move.w (a1),GraphicRoom(a3)
  6637.  
  6638.  moveq #0,d0
  6639.  move.b p3_gunselected,d0
  6640.  
  6641.  move.l LINKFILE,a1
  6642.  add.l #GunObjects,a1
  6643.  move.w (a1,d0.w*2),d0
  6644.  
  6645.  move.b d0,TypeOfThing(a3)
  6646.  move.b #1,16(a3)
  6647.  
  6648.  move.w (a0),d0
  6649.  move.w (a3),d1
  6650.  move.l ObjectPoints,a1
  6651.  move.l (a1,d0.w*8),(a1,d1.w*8) 
  6652.  move.l 4(a1,d0.w*8),4(a1,d1.w*8) 
  6653.  
  6654.  st WhichAnim(a3)
  6655.  
  6656.  move.l p3_yoff,d0
  6657.  move.l p3_height,d1
  6658.  asr.l #2,d1
  6659.  add.l #10*128,d1
  6660.  add.l d1,d0
  6661.  asr.l #7,d0
  6662.  move.w d0,4(a3)
  6663.  move.l PLR3_BOBBLEY,d1
  6664.  asr.l #8,d1
  6665.  move.l d1,d0
  6666.  asr.l #1,d0
  6667.  add.l d0,d1
  6668.  add.w d1,4(a3)
  6669.  
  6670.  move.b ObjInTop(a0),ObjInTop(a3)
  6671.  
  6672.  endc
  6673.  
  6674.  ifne CHEESEY
  6675.  
  6676.  move.w #-1,12(a3)
  6677.  endc
  6678.  
  6679.  rts
  6680.  
  6681.  
  6682. GunSelected: dc.b 0
  6683.  even
  6684.  
  6685.  
  6686. GunData: dc.l 0
  6687.  
  6688.  
  6689. protA: dc.w 0
  6690.  
  6691. Path:
  6692. ; incbin "testpath"
  6693. endpath:
  6694. pathpt: dc.l Path
  6695.  
  6696.  
  6697. PLR1KEYS: dc.b 0
  6698. PLR1PATH: dc.b 0
  6699. PLR1MOUSE: dc.b -1
  6700. PLR1JOY: dc.b 0
  6701. PLR2KEYS: dc.b 0
  6702. PLR2PATH: dc.b 0
  6703. PLR2MOUSE: dc.b -1
  6704. PLR2JOY: dc.b 0
  6705. PLR3KEYS: dc.b 0
  6706. PLR3PATH: dc.b 0
  6707. PLR3MOUSE: dc.b -1
  6708. PLR3JOY: dc.b 0
  6709.  
  6710.  even
  6711.  
  6712. PLR1_bobble: dc.w 0
  6713. PLR2_bobble: dc.w 0
  6714. PLR3_bobble: dc.w 0
  6715. xwobble: dc.l 0
  6716. xwobxoff: dc.w 0
  6717.  
  6718. xwobzoff: dc.w 0
  6719.  
  6720. PLR1_Control:
  6721.  
  6722. ; Take a snapshot of everything.
  6723.  
  6724.  move.l PLR1_xoff,d2
  6725.  move.l d2,PLR1_oldxoff
  6726.  move.l d2,oldx
  6727.  move.l PLR1_zoff,d3
  6728.  move.l d3,PLR1_oldzoff
  6729.  move.l d3,oldz
  6730.  move.l p1_xoff,d0
  6731.  move.l d0,PLR1_xoff
  6732.  move.l d0,newx
  6733.  move.l p1_zoff,d1
  6734.  move.l d1,newz
  6735.  move.l d1,PLR1_zoff
  6736.  
  6737.  move.l p1_height,PLR1_height
  6738.  
  6739.  sub.l d2,d0
  6740.  sub.l d3,d1
  6741.  move.l d0,xdiff
  6742.  move.l d1,zdiff
  6743.  move.w p1_angpos,d0
  6744.  move.w d0,PLR1_angpos
  6745.  
  6746.  move.l #SineTable,a1
  6747.  move.w (a1,d0.w),PLR1_sinval
  6748.  add.w #2048,d0
  6749.  and.w #8190,d0
  6750.  move.w (a1,d0.w),PLR1_cosval
  6751.  
  6752.  move.l p1_yoff,d0
  6753.  move.w p1_bobble,d1
  6754.  move.w (a1,d1.w),d1
  6755.  move.w d1,d3
  6756.  ble.s .notnegative
  6757.  neg.w d1
  6758. .notnegative:
  6759.  add.w #16384,d1
  6760.  asr.w #4,d1
  6761.  
  6762.  tst.b PLR1_Ducked
  6763.  bne.s .notdouble
  6764.  tst.b PLR1_Squished
  6765.  bne.s .notdouble
  6766.  add.w d1,d1
  6767. .notdouble
  6768.  ext.l d1
  6769.  
  6770.  move.l d1,PLR1_BOBBLEY
  6771.  
  6772.  move.l PLR1_height,d4
  6773.  sub.l d1,d4
  6774.  add.l d1,d0
  6775.  
  6776.  cmp.b #'s',mors
  6777.  beq.s .otherwob
  6778.  asr.w #6,d3
  6779.  ext.l d3
  6780.  move.l d3,xwobble
  6781.  move.w PLR1_sinval,d1
  6782.  muls d3,d1
  6783.  move.w PLR1_cosval,d2
  6784.  muls d3,d2
  6785.  swap d1
  6786.  swap d2
  6787.  asr.w #7,d1
  6788.  move.w d1,xwobxoff
  6789.  asr.w #7,d2
  6790.  neg.w d2
  6791.  move.w d2,xwobzoff
  6792. .otherwob
  6793.  
  6794.  move.l d0,PLR1_yoff
  6795.  move.l d0,newy
  6796.  move.l d0,oldy
  6797.  
  6798.  move.l d4,thingheight
  6799.  move.l #40*256,StepUpVal
  6800.  tst.b PLR1_Squished
  6801.  bne.s .smallstep
  6802.  tst.b PLR1_Ducked
  6803.  beq.s .okbigstep
  6804. .smallstep
  6805.  move.l #10*256,StepUpVal
  6806. .okbigstep:
  6807.  
  6808.  move.l #$1000000,StepDownVal
  6809.  
  6810.  move.l PLR1_Roompt,a0
  6811.  move.w ToTelZone(a0),d0
  6812.  blt .noteleport
  6813.  
  6814.  move.w ToTelX(a0),newx
  6815.  move.w ToTelZ(a0),newz
  6816.  
  6817.  move.l PLR1_Obj,a0
  6818.  move.w (a0),CollId
  6819.  
  6820.  move.l #%111111111111111111,CollideFlags
  6821.  jsr Collision
  6822.  tst.b hitwall
  6823.  beq.s .teleport
  6824.  
  6825.  move.w PLR1_xoff,newx
  6826.  move.w PLR1_zoff,newz
  6827.  bra .noteleport
  6828.  
  6829. .teleport:
  6830.  
  6831.  st PLR1_TELEPORTED
  6832.  
  6833.  move.l PLR1_Roompt,a0
  6834.  move.w ToTelZone(a0),d0
  6835.  move.w ToTelX(a0),PLR1_xoff
  6836.  move.w ToTelZ(a0),PLR1_zoff
  6837.  move.l PLR1_yoff,d1
  6838.  sub.l ToZoneFloor(a0),d1
  6839.  move.l ZoneAdds,a0
  6840.  move.l (a0,d0.w*4),a0
  6841.  add.l LEVELDATA,a0
  6842.  move.l a0,PLR1_Roompt
  6843.  add.l ToZoneFloor(a0),d1
  6844.  move.l d1,PLR1s_yoff
  6845.  move.l d1,PLR1_yoff
  6846.  move.l d1,PLR1s_tyoff
  6847.  move.l PLR1_xoff,PLR1s_xoff
  6848.  move.l PLR1_zoff,PLR1s_zoff
  6849.  
  6850.  SAVEREGS
  6851.  move.w #0,Noisex
  6852.  move.w #0,Noisez
  6853.  move.w #26,Samplenum
  6854.  move.w #100,Noisevol
  6855.  move.w #$fff9,IDNUM
  6856.  jsr MakeSomeNoise
  6857.  GETREGS
  6858.  
  6859.  bra .cantmove
  6860.  
  6861. .noteleport:
  6862.  
  6863.  move.l PLR1_Roompt,objroom
  6864.  move.w #%100000000,wallflags
  6865.  move.b PLR1_StoodInTop,StoodInTop
  6866.  
  6867.  move.l #%1011111110111000011,CollideFlags
  6868.  move.l PLR1_Obj,a0
  6869.  move.w (a0),CollId
  6870.  
  6871.  jsr Collision
  6872.  tst.b hitwall
  6873.  beq.s .nothitanything
  6874.  move.w oldx,PLR1_xoff
  6875.  move.w oldz,PLR1_zoff
  6876.  move.l PLR1_xoff,PLR1s_xoff
  6877.  move.l PLR1_zoff,PLR1s_zoff
  6878.  bra .cantmove
  6879. .nothitanything:
  6880.  
  6881.  move.w #40,extlen
  6882.  move.b #0,awayfromwall
  6883.  
  6884.  clr.b exitfirst
  6885.  clr.b wallbounce
  6886.  bsr MoveObject
  6887.  move.b StoodInTop,PLR1_StoodInTop
  6888.  move.l objroom,PLR1_Roompt
  6889.  move.w newx,PLR1_xoff
  6890.  move.w newz,PLR1_zoff
  6891.  move.l PLR1_xoff,PLR1s_xoff
  6892.  move.l PLR1_zoff,PLR1s_zoff
  6893.  
  6894. .cantmove:
  6895.  
  6896.  move.l PLR1_Roompt,a0
  6897.  
  6898.  move.l ToZoneFloor(a0),d0
  6899.  tst.b PLR1_StoodInTop
  6900.  beq.s notintop
  6901.  move.l ToUpperFloor(a0),d0
  6902. notintop:
  6903.  
  6904.  adda.w #ToZonePts,a0
  6905.  sub.l PLR1_height,d0
  6906.  move.l d0,PLR1s_tyoff
  6907.  move.w p1_angpos,tmpangpos
  6908.  
  6909. ; move.l (a0),a0        ; jump to viewpoint list
  6910.  * A0 is pointing at a pointer to list of points to rotate
  6911.  move.w (a0)+,d1
  6912.  ext.l d1
  6913.  add.l PLR1_Roompt,d1
  6914.  move.l d1,PLR1_PointsToRotatePtr
  6915.  tst.b (a0)+
  6916.  sne.s DRAWNGRAPHTOP
  6917.  beq.s nobackgraphics
  6918.  cmp.b #'1',WHICHAMI
  6919.  bne.s nobackgraphics
  6920.  move.l a0,-(a7)
  6921.  jsr putinbackdrop 
  6922.  move.l (a7)+,a0
  6923. nobackgraphics:
  6924.  
  6925.  move.b (a0)+,PLR1_Echo
  6926.  
  6927.  adda.w #10,a0
  6928.  move.l a0,PLR1_ListOfGraphRooms
  6929.  
  6930. *************************************************
  6931.  rts
  6932.  
  6933. DRAWNGRAPHTOP
  6934.  dc.w 0 
  6935. tstzone: dc.l 0
  6936. CollId: dc.w 0
  6937.  
  6938. PLR2_Control:
  6939.  
  6940. ; Take a snapshot of everything.
  6941.  
  6942.  move.l PLR2_xoff,d2
  6943.  move.l d2,PLR2_oldxoff
  6944.  move.l d2,oldx
  6945.  move.l PLR2_zoff,d3
  6946.  move.l d3,PLR2_oldzoff
  6947.  move.l d3,oldz
  6948.  move.l p2_xoff,d0
  6949.  move.l d0,PLR2_xoff
  6950.  move.l d0,newx
  6951.  move.l p2_zoff,d1
  6952.  move.l d1,newz
  6953.  move.l d1,PLR2_zoff
  6954.  
  6955.  move.l p2_height,PLR2_height
  6956.  
  6957.  sub.l d2,d0
  6958.  sub.l d3,d1
  6959.  move.l d0,xdiff
  6960.  move.l d1,zdiff
  6961.  move.w p2_angpos,d0
  6962.  move.w d0,PLR2_angpos
  6963.  
  6964.  move.l #SineTable,a1
  6965.  move.w (a1,d0.w),PLR2_sinval
  6966.  add.w #2048,d0
  6967.  and.w #8190,d0
  6968.  move.w (a1,d0.w),PLR2_cosval
  6969.  
  6970.  move.l p2_yoff,d0
  6971.  move.w p2_bobble,d1
  6972.  move.w (a1,d1.w),d1
  6973.  move.w d1,d3
  6974.  ble.s .notnegative
  6975.  neg.w d1
  6976. .notnegative:
  6977.  add.w #16384,d1
  6978.  asr.w #4,d1
  6979.  
  6980.  tst.b PLR2_Ducked
  6981.  bne.s .notdouble
  6982.  tst.b PLR2_Squished
  6983.  bne.s .notdouble
  6984.  add.w d1,d1
  6985. .notdouble
  6986.  ext.l d1
  6987.  
  6988.  move.l d1,PLR2_BOBBLEY
  6989.  
  6990.  move.l PLR2_height,d4
  6991.  sub.l d1,d4
  6992.  add.l d1,d0
  6993.  
  6994.  cmp.b #'s',mors
  6995.  bne.s .otherwob
  6996.  asr.w #6,d3
  6997.  ext.l d3
  6998.  move.l d3,xwobble
  6999.  move.w PLR2_sinval,d1
  7000.  muls d3,d1
  7001.  move.w PLR2_cosval,d2
  7002.  muls d3,d2
  7003.  swap d1
  7004.  swap d2
  7005.  asr.w #7,d1
  7006.  move.w d1,xwobxoff
  7007.  asr.w #7,d2
  7008.  neg.w d2
  7009.  move.w d2,xwobzoff
  7010. .otherwob
  7011.  
  7012.  move.l d0,PLR2_yoff
  7013.  move.l d0,newy
  7014.  move.l d0,oldy
  7015.  
  7016.  move.l d4,thingheight
  7017.  move.l #40*256,StepUpVal
  7018.  tst.b PLR2_Squished
  7019.  bne.s .smallstep
  7020.  tst.b PLR2_Ducked
  7021.  beq.s .okbigstep
  7022. .smallstep:
  7023.  move.l #10*256,StepUpVal
  7024. .okbigstep:
  7025.  
  7026.  move.l #$1000000,StepDownVal
  7027.  
  7028.  move.l PLR2_Roompt,a0
  7029.  move.w ToTelZone(a0),d0
  7030.  blt .noteleport
  7031.  
  7032.  move.w ToTelX(a0),newx
  7033.  move.w ToTelZ(a0),newz
  7034.  move.w PLR2_Obj,a0
  7035.  move.w (a0),CollId
  7036.  move.l #%111111111111111111,CollideFlags
  7037.  jsr Collision
  7038.  tst.b hitwall
  7039.  beq.s .teleport
  7040.  
  7041.  move.w PLR2_xoff,newx
  7042.  move.w PLR2_zoff,newz
  7043.  bra .noteleport
  7044.  
  7045. .teleport:
  7046.  
  7047.  st PLR2_TELEPORTED
  7048.  
  7049.  move.l PLR2_Roompt,a0
  7050.  move.w ToTelZone(a0),d0
  7051.  move.w ToTelX(a0),PLR2_xoff
  7052.  move.w ToTelZ(a0),PLR2_zoff
  7053.  move.l PLR2_yoff,d1
  7054.  sub.l ToZoneFloor(a0),d1
  7055.  move.l ZoneAdds,a0
  7056.  move.l (a0,d0.w*4),a0
  7057.  add.l LEVELDATA,a0
  7058.  move.l a0,PLR2_Roompt
  7059.  add.l ToZoneFloor(a0),d1
  7060.  move.l d1,PLR2s_yoff
  7061.  move.l d1,PLR2_yoff
  7062.  move.l d1,PLR2s_tyoff
  7063.  move.l PLR2_xoff,PLR2s_xoff
  7064.  move.l PLR2_zoff,PLR2s_zoff
  7065.  
  7066.  SAVEREGS
  7067.  move.w #0,Noisex
  7068.  move.w #0,Noisez
  7069.  move.w #26,Samplenum
  7070.  move.w #100,Noisevol
  7071.  move.w #$fff9,IDNUM
  7072.  jsr MakeSomeNoise
  7073.  GETREGS
  7074.  
  7075.  bra .cantmove
  7076.  
  7077. .noteleport:
  7078.  
  7079.  move.l PLR2_Roompt,objroom
  7080.  move.w #%100000000000,wallflags
  7081.  move.b PLR2_StoodInTop,StoodInTop
  7082.  
  7083.  move.l #%1011111010111100011,CollideFlags
  7084.  move.l PLR2_Obj,a0
  7085.  move.w (a0),CollId
  7086.  
  7087.  jsr Collision
  7088.  tst.b hitwall
  7089.  beq.s .nothitanything
  7090.  move.w oldx,PLR2_xoff
  7091.  move.w oldz,PLR2_zoff
  7092.  move.l PLR2_xoff,PLR2s_xoff
  7093.  move.l PLR2_zoff,PLR2s_zoff
  7094.  bra .cantmove
  7095. .nothitanything:
  7096.  
  7097.  move.w #40,extlen
  7098.  move.b #0,awayfromwall
  7099.  
  7100.  clr.b exitfirst
  7101.  clr.b wallbounce
  7102.  bsr MoveObject
  7103.  move.b StoodInTop,PLR2_StoodInTop
  7104.  move.l objroom,PLR2_Roompt
  7105.  move.w newx,PLR2_xoff
  7106.  move.w newz,PLR2_zoff
  7107.  move.l PLR2_xoff,PLR2s_xoff
  7108.  move.l PLR2_zoff,PLR2s_zoff
  7109.  
  7110. .cantmove
  7111.  
  7112.  move.l PLR2_Roompt,a0
  7113.  
  7114.  move.l ToZoneFloor(a0),d0
  7115.  tst.b PLR2_StoodInTop
  7116.  beq.s .notintop
  7117.  move.l ToUpperFloor(a0),d0
  7118. .notintop:
  7119.  
  7120.  adda.w #ToZonePts,a0
  7121.  sub.l PLR2_height,d0
  7122.  move.l d0,PLR2s_tyoff
  7123.  move.w p2_angpos,tmpangpos
  7124.  
  7125. ; move.l (a0),a0        ; jump to viewpoint list
  7126.  * A0 is pointing at a pointer to list of points to rotate
  7127.  move.w (a0)+,d1
  7128.  ext.l d1
  7129.  add.l PLR2_Roompt,d1
  7130.  move.l d1,PLR2_PointsToRotatePtr
  7131.  tst.b (a0)+
  7132.  sne.s DRAWNGRAPHTOP
  7133.  beq.s .nobackgraphics
  7134.  cmp.b #'2',WHICHAMI
  7135.  bne.s .nobackgraphics
  7136.  move.l a0,-(a7)
  7137.  jsr putinbackdrop 
  7138.  move.l (a7)+,a0
  7139. .nobackgraphics:
  7140.  
  7141.  move.b (a0)+,PLR2_Echo
  7142.  
  7143.  adda.w #10,a0
  7144.  move.l a0,PLR2_ListOfGraphRooms
  7145.  
  7146. *****************************************************
  7147.  rts
  7148.  
  7149.  
  7150.  
  7151. PLR3_Control:
  7152.  
  7153. ; Take a snapshot of everything.
  7154.  
  7155.  move.l PLR3_xoff,d2
  7156.  move.l d2,PLR3_oldxoff
  7157.  move.l d2,oldx
  7158.  move.l PLR3_zoff,d3
  7159.  move.l d3,PLR3_oldzoff
  7160.  move.l d3,oldz
  7161.  move.l p3_xoff,d0
  7162.  move.l d0,PLR3_xoff
  7163.  move.l d0,newx
  7164.  move.l p3_zoff,d1
  7165.  move.l d1,newz
  7166.  move.l d1,PLR3_zoff
  7167.  
  7168.  move.l p3_height,PLR3_height
  7169.  
  7170.  sub.l d2,d0
  7171.  sub.l d3,d1
  7172.  move.l d0,xdiff
  7173.  move.l d1,zdiff
  7174.  move.w p3_angpos,d0
  7175.  move.w d0,PLR3_angpos
  7176.  
  7177.  move.l #SineTable,a1
  7178.  move.w (a1,d0.w),PLR3_sinval
  7179.  add.w #2048,d0
  7180.  and.w #8190,d0
  7181.  move.w (a1,d0.w),PLR3_cosval
  7182.  
  7183.  move.l p3_yoff,d0
  7184.  move.w p3_bobble,d1
  7185.  move.w (a1,d1.w),d1
  7186.  move.w d1,d3
  7187.  ble.s .notnegative
  7188.  neg.w d1
  7189. .notnegative:
  7190.  add.w #16384,d1
  7191.  asr.w #4,d1
  7192.  
  7193.  tst.b PLR3_Ducked
  7194.  bne.s .notdouble
  7195.  tst.b PLR3_Squished
  7196.  bne.s .notdouble
  7197.  add.w d1,d1
  7198. .notdouble
  7199.  ext.l d1
  7200.  
  7201.  move.l d1,PLR3_BOBBLEY
  7202.  
  7203.  move.l PLR3_height,d4
  7204.  sub.l d1,d4
  7205.  add.l d1,d0
  7206.  
  7207.  cmp.b #'s',mors
  7208.  bne.s .otherwob
  7209.  asr.w #6,d3
  7210.  ext.l d3
  7211.  move.l d3,xwobble
  7212.  move.w PLR3_sinval,d1
  7213.  muls d3,d1
  7214.  move.w PLR3_cosval,d2
  7215.  muls d3,d2
  7216.  swap d1
  7217.  swap d2
  7218.  asr.w #7,d1
  7219.  move.w d1,xwobxoff
  7220.  asr.w #7,d2
  7221.  neg.w d2
  7222.  move.w d2,xwobzoff
  7223. .otherwob
  7224.  
  7225.  move.l d0,PLR3_yoff
  7226.  move.l d0,newy
  7227.  move.l d0,oldy
  7228.  
  7229.  move.l d4,thingheight
  7230.  move.l #40*256,StepUpVal
  7231.  tst.b PLR3_Squished
  7232.  bne.s .smallstep
  7233.  tst.b PLR3_Ducked
  7234.  beq.s .okbigstep
  7235. .smallstep:
  7236.  move.l #10*256,StepUpVal
  7237. .okbigstep:
  7238.  
  7239.  move.l #$1000000,StepDownVal
  7240.  
  7241.  move.l PLR3_Roompt,a0
  7242.  move.w ToTelZone(a0),d0
  7243.  blt .noteleport
  7244.  
  7245.  move.w ToTelX(a0),newx
  7246.  move.w ToTelZ(a0),newz
  7247.  move.w PLR3_Obj,a0
  7248.  move.w (a0),CollId
  7249.  move.l #%111111111111111111,CollideFlags
  7250.  jsr Collision
  7251.  tst.b hitwall
  7252.  beq.s .teleport
  7253.  
  7254.  move.w PLR3_xoff,newx
  7255.  move.w PLR3_zoff,newz
  7256.  bra .noteleport
  7257.  
  7258. .teleport:
  7259.  
  7260.  st PLR3_TELEPORTED
  7261.  
  7262.  move.l PLR3_Roompt,a0
  7263.  move.w ToTelZone(a0),d0
  7264.  move.w ToTelX(a0),PLR3_xoff
  7265.  move.w ToTelZ(a0),PLR3_zoff
  7266.  move.l PLR3_yoff,d1
  7267.  sub.l ToZoneFloor(a0),d1
  7268.  move.l ZoneAdds,a0
  7269.  move.l (a0,d0.w*4),a0
  7270.  add.l LEVELDATA,a0
  7271.  move.l a0,PLR3_Roompt
  7272.  add.l ToZoneFloor(a0),d1
  7273.  move.l d1,PLR3s_yoff
  7274.  move.l d1,PLR3_yoff
  7275.  move.l d1,PLR3s_tyoff
  7276.  move.l PLR3_xoff,PLR3s_xoff
  7277.  move.l PLR3_zoff,PLR3s_zoff
  7278.  
  7279.  SAVEREGS
  7280.  move.w #0,Noisex
  7281.  move.w #0,Noisez
  7282.  move.w #26,Samplenum
  7283.  move.w #100,Noisevol
  7284.  move.w #$fff9,IDNUM
  7285.  jsr MakeSomeNoise
  7286.  GETREGS
  7287.  
  7288.  bra .cantmove
  7289.  
  7290. .noteleport:
  7291.  
  7292.  move.l PLR3_Roompt,objroom
  7293.  move.w #%100000000000,wallflags
  7294.  move.b PLR3_StoodInTop,StoodInTop
  7295.  
  7296.  move.l #%1011111010111100011,CollideFlags
  7297.  move.l PLR3_Obj,a0
  7298.  move.w (a0),CollId
  7299.  
  7300.  jsr Collision
  7301.  tst.b hitwall
  7302.  beq.s .nothitanything
  7303.  move.w oldx,PLR3_xoff
  7304.  move.w oldz,PLR3_zoff
  7305.  move.l PLR3_xoff,PLR3s_xoff
  7306.  move.l PLR3_zoff,PLR3s_zoff
  7307.  bra .cantmove
  7308. .nothitanything:
  7309.  
  7310.  move.w #40,extlen
  7311.  move.b #0,awayfromwall
  7312.  
  7313.  clr.b exitfirst
  7314.  clr.b wallbounce
  7315.  bsr MoveObject
  7316.  move.b StoodInTop,PLR3_StoodInTop
  7317.  move.l objroom,PLR3_Roompt
  7318.  move.w newx,PLR3_xoff
  7319.  move.w newz,PLR3_zoff
  7320.  move.l PLR3_xoff,PLR3s_xoff
  7321.  move.l PLR3_zoff,PLR3s_zoff
  7322.  
  7323. .cantmove
  7324.  
  7325.  move.l PLR3_Roompt,a0
  7326.  
  7327.  move.l ToZoneFloor(a0),d0
  7328.  tst.b PLR3_StoodInTop
  7329.  beq.s .notintop
  7330.  move.l ToUpperFloor(a0),d0
  7331. .notintop:
  7332.  
  7333.  adda.w #ToZonePts,a0
  7334.  sub.l PLR3_height,d0
  7335.  move.l d0,PLR3s_tyoff
  7336.  move.w p3_angpos,tmpangpos
  7337.  
  7338. ; move.l (a0),a0        ; jump to viewpoint list
  7339.  * A0 is pointing at a pointer to list of points to rotate
  7340.  move.w (a0)+,d1
  7341.  ext.l d1
  7342.  add.l PLR3_Roompt,d1
  7343.  move.l d1,PLR3_PointsToRotatePtr
  7344.  tst.b (a0)+
  7345.  sne.s DRAWNGRAPHTOP
  7346.  beq.s .nobackgraphics
  7347.  cmp.b #'3',WHICHAMI
  7348.  bne.s .nobackgraphics
  7349.  move.l a0,-(a7)
  7350.  jsr putinbackdrop 
  7351.  move.l (a7)+,a0
  7352. .nobackgraphics:
  7353.  
  7354.  move.b (a0)+,PLR3_Echo
  7355.  
  7356.  adda.w #10,a0
  7357.  move.l a0,PLR3_ListOfGraphRooms
  7358.  
  7359. *****************************************************
  7360.  rts
  7361.  
  7362.  
  7363. PLR3_BOBBLEY: dc.l 0
  7364.  
  7365. KeyMap: ds.b 256
  7366.  
  7367. fillscrnwater:
  7368.  dc.w 0
  7369. DONTDOGUN:
  7370.  dc.w 0
  7371.  
  7372. ;temptemp: ds.l 200
  7373. ;temptempptr: dc.l 0
  7374.  
  7375. DrawDisplay:
  7376.  
  7377. ; move.l #temptemp,temptempptr
  7378.  
  7379.  clr.b fillscrnwater
  7380.  
  7381.  move.l #SineTable,a0
  7382.  move.w angpos,d0
  7383.  move.w (a0,d0.w),d6
  7384.  adda.w #2048,a0
  7385.  move.w (a0,d0.w),d7
  7386.  move.w d6,sinval
  7387.  move.w d7,cosval
  7388.  
  7389.  move.l yoff,d0
  7390.  asr.l #8,d0
  7391.  move.w d0,d1
  7392.  add.w #256-32,d1
  7393.  and.w #255,d1
  7394.  move.w d1,wallyoff
  7395.  move.l yoff,d0
  7396.  asr.l #6,d0
  7397.  move.w d0,flooryoff
  7398.  
  7399.  move.w xoff,d6
  7400.  move.w d6,d3
  7401.  asr.w #1,d3
  7402.  add.w d3,d6
  7403.  asr.w #1,d6
  7404.  move.w d6,xoff34
  7405.  
  7406.  move.w zoff,d6
  7407.  move.w d6,d3
  7408.  asr.w #1,d3
  7409.  add.w d3,d6
  7410.  asr.w #1,d6
  7411.  move.w d6,zoff34
  7412.  
  7413.  bsr RotateLevelPts
  7414.  bsr RotateObjectPts
  7415.  bsr CalcPLR1InLine
  7416.  bsr CalcPLR3InLine
  7417.  
  7418.  cmp.b #'n',mors
  7419.  bne.s doplr2too
  7420.  move.l PLR2_Obj,a0
  7421.  move.w #-1,12(a0)
  7422.  move.w #-1,GraphicRoom(a0)
  7423.  bra noplr2either
  7424.  
  7425. doplr2too:
  7426.  bsr CalcPLR2InLine
  7427. noplr2either:
  7428.  
  7429.  move.l endoflist,a0
  7430. ; move.w #-1,(a0)
  7431.  
  7432. ; move.l #FinalOrder,a0
  7433.  
  7434.  
  7435. subroomloop:
  7436. ; move.w (a0)+,d7
  7437.  move.w -(a0),d7
  7438.  blt jumpoutofrooms
  7439.  
  7440. ; bsr setlrclip
  7441. ; move.w leftclip,d0
  7442. ; cmp.w rightclip,d0
  7443. ; bge subroomloop
  7444.  move.l a0,-(a7)
  7445.  
  7446.  move.l ZoneAdds,a0
  7447.  move.l (a0,d7.w*4),a0
  7448.  add.l LEVELDATA,a0
  7449.  move.l ToZoneRoof(a0),SplitHeight
  7450.  move.l a0,ROOMBACK
  7451.  
  7452.  move.l ZoneGraphAdds,a0
  7453.  move.l 4(a0,d7.w*8),a2
  7454.  move.l (a0,d7.w*8),a0
  7455.  
  7456.  add.l LEVELGRAPHICS,a0
  7457.  add.l LEVELGRAPHICS,a2
  7458.  move.l a2,ThisRoomToDraw+4
  7459.  move.l a0,ThisRoomToDraw
  7460.  
  7461.  move.l ListOfGraphRooms,a1
  7462.  
  7463.  
  7464.  
  7465. finditit:
  7466.  tst.w (a1)
  7467.  blt nomoretodoatall
  7468.  cmp.w (a1),d7
  7469.  beq outoffind
  7470.  adda.w #8,a1
  7471.  bra finditit
  7472.  
  7473. outoffind:
  7474.  
  7475.  move.l a1,-(a7)
  7476.  
  7477.  
  7478.  move.w #0,leftclip
  7479.  move.w RIGHTX,rightclip
  7480.  moveq #0,d7
  7481.  move.w 2(a1),d7
  7482.  blt.s outofrcliplop
  7483.  move.l LEVELCLIPS,a0
  7484.  lea (a0,d7.l*2),a0
  7485.  
  7486.  tst.w (a0)
  7487.  blt outoflcliplop
  7488.  
  7489.  bsr NEWsetlclip
  7490.  
  7491. intolcliplop:        ; clips
  7492.  tst.w (a0)
  7493.  blt outoflcliplop
  7494.  
  7495.  bsr NEWsetlclip 
  7496.  bra intolcliplop
  7497.  
  7498. outoflcliplop:
  7499.  
  7500.  addq #2,a0
  7501.  
  7502.  tst.w (a0)
  7503.  blt outofrcliplop
  7504.  
  7505.  bsr NEWsetrclip
  7506.  
  7507. intorcliplop:        ; clips
  7508.  tst.w (a0)
  7509.  blt outofrcliplop
  7510.  
  7511.  bsr NEWsetrclip 
  7512.  bra intorcliplop
  7513.  
  7514. outofrcliplop:
  7515.  
  7516.  
  7517.  move.w leftclip,d0
  7518.  ext.l d0
  7519.  move.l d0,leftclip-2
  7520.  
  7521.  cmp.w RIGHTX,d0
  7522.  bge dontbothercantseeit
  7523.  move.w rightclip,d1
  7524.  ext.l d1
  7525.  move.l d1,rightclip-2
  7526.  blt dontbothercantseeit
  7527.  cmp.w d1,d0
  7528.  bge dontbothercantseeit
  7529.  
  7530.  move.l yoff,d0
  7531.  cmp.l SplitHeight,d0
  7532.  blt botfirst
  7533.  
  7534.  move.l ThisRoomToDraw+4,a0
  7535.  cmp.l LEVELGRAPHICS,a0
  7536.  beq.s noupperroom
  7537.  st DOUPPER
  7538.  
  7539.  move.l ROOMBACK,a1
  7540.  move.l ToUpperRoof(a1),TOPOFROOM
  7541.  move.l ToUpperFloor(a1),BOTOFROOM
  7542.  
  7543.  move.l #CurrentPointBrights+4,PointBrightsPtr
  7544.  bsr dothisroom
  7545. noupperroom:
  7546.  move.l ThisRoomToDraw,a0
  7547.  clr.b DOUPPER
  7548.  move.l #CurrentPointBrights,PointBrightsPtr
  7549.  
  7550.  move.l ROOMBACK,a1
  7551.  move.l ToZoneRoof(a1),d0
  7552.  move.l d0,TOPOFROOM
  7553.  move.l ToZoneFloor(a1),d1
  7554.  move.l d1,BOTOFROOM
  7555.  
  7556.  move.l ToZoneWater(a1),d2
  7557.  cmp.l yoff,d2
  7558.  blt.s .abovefirst
  7559.  move.l d2,BEFOREWATTOP
  7560.  move.l d1,BEFOREWATBOT
  7561.  move.l d2,AFTERWATBOT
  7562.  move.l d0,AFTERWATTOP
  7563.  bra.s .belowfirst
  7564. .abovefirst:
  7565.  move.l d0,BEFOREWATTOP
  7566.  move.l d2,BEFOREWATBOT
  7567.  move.l d1,AFTERWATBOT
  7568.  move.l d2,AFTERWATTOP
  7569. .belowfirst:
  7570.  
  7571.  bsr dothisroom
  7572.  
  7573.  bra dontbothercantseeit
  7574. botfirst:
  7575.  
  7576.  move.l ThisRoomToDraw,a0
  7577.  clr.b DOUPPER
  7578.  move.l #CurrentPointBrights,PointBrightsPtr
  7579.  
  7580.  move.l ROOMBACK,a1
  7581.  move.l ToZoneRoof(a1),d0
  7582.  move.l d0,TOPOFROOM
  7583.  move.l ToZoneFloor(a1),d1
  7584.  move.l d1,BOTOFROOM
  7585.  
  7586.  move.l ToZoneWater(a1),d2
  7587.  cmp.l yoff,d2
  7588.  blt.s .abovefirst
  7589.  move.l d2,BEFOREWATTOP
  7590.  move.l d1,BEFOREWATBOT
  7591.  move.l d2,AFTERWATBOT
  7592.  move.l d0,AFTERWATTOP
  7593.  bra.s .belowfirst
  7594. .abovefirst:
  7595.  move.l d0,BEFOREWATTOP
  7596.  move.l d2,BEFOREWATBOT
  7597.  move.l d1,AFTERWATBOT
  7598.  move.l d2,AFTERWATTOP
  7599. .belowfirst:
  7600.  
  7601.  
  7602.  bsr dothisroom
  7603.  move.l ThisRoomToDraw+4,a0
  7604.  cmp.l LEVELGRAPHICS,a0
  7605.  beq.s noupperroom2
  7606.  move.l #CurrentPointBrights+4,PointBrightsPtr
  7607.  
  7608.  move.l ROOMBACK,a1
  7609.  move.l ToUpperRoof(a1),TOPOFROOM
  7610.  move.l ToUpperFloor(a1),BOTOFROOM
  7611.  
  7612.  st DOUPPER
  7613.  bsr dothisroom
  7614. noupperroom2:
  7615.  
  7616. dontbothercantseeit:
  7617. pastemp:
  7618.  
  7619.  move.l (a7)+,a1
  7620.  move.l ThisRoomToDraw,a0
  7621.  move.w (a0),d7
  7622.  
  7623.  adda.w #8,a1
  7624.  bra finditit
  7625.  
  7626. nomoretodoatall:
  7627.  
  7628.  move.l (a7)+,a0
  7629.  
  7630.  bra subroomloop
  7631.  
  7632. jumpoutofrooms:
  7633.  
  7634.  
  7635.  tst.b DONTDOGUN
  7636.  bne NOGUNLOOK
  7637.  
  7638.  cmp.b #'s',mors
  7639.  beq.s drawslavegun
  7640.  
  7641.  moveq #0,d0
  7642.  move.b PLR1_GunSelected,d0
  7643.  moveq #0,d1
  7644.  move.b PLR1_GunFrame,d1
  7645. ; bsr DRAWINGUN
  7646.  bra drawngun
  7647.  
  7648. drawslavegun
  7649.  moveq #0,d0
  7650.  move.b PLR2_GunSelected,d0
  7651.  moveq #0,d1
  7652.  move.b PLR2_GunFrame,d1
  7653. ; bsr DRAWINGUN
  7654.  
  7655. drawngun:
  7656.  
  7657. NOGUNLOOK:
  7658.  
  7659.  moveq #0,d1
  7660.  move.b PLR1_GunFrame,d1
  7661.  sub.w TempFrames,d1
  7662.  bgt.s .nn
  7663.  moveq #0,d1
  7664. .nn
  7665.  move.b d1,PLR1_GunFrame
  7666.  
  7667.  ble.s .donefire
  7668.  sub.b #1,PLR1_GunFrame
  7669. .donefire:
  7670.  
  7671.  moveq #0,d1
  7672.  move.b PLR2_GunFrame,d1
  7673.  sub.w TempFrames,d1
  7674.  bgt.s .nn2
  7675.  moveq #0,d1
  7676. .nn2
  7677.  move.b d2,PLR2_GunFrame
  7678.  
  7679.  ble.s .donefire2
  7680.  sub.b #1,PLR2_GunFrame
  7681. .donefire2:
  7682.  
  7683.  tst.b DOANYWATER
  7684.  beq.s nowaterfull
  7685.  
  7686.  move.w #231,d0
  7687.  move.l FASTBUFFER,a0
  7688.  tst.b fillscrnwater
  7689.  beq nowaterfull
  7690.  bgt oknothalf
  7691.  moveq #119,d0
  7692.  add.l #320*120*2,a0
  7693. oknothalf:
  7694.  
  7695.  bclr.b #1,$bfe001
  7696.  
  7697.  move.l TexturePal,a2
  7698.  add.l #256*40,a2
  7699.  moveq #0,d2
  7700.  
  7701.  tst.b FULLSCR
  7702.  bne.s DOALLSCREEN
  7703.  
  7704. DOSOMESCREEN:
  7705.  
  7706.  move.w #159,d0
  7707. .fw:
  7708.  move.w #191,d1
  7709. .fwa:
  7710.  move.b (a0),d2
  7711.  move.b (a2,d2.w),(a0)+
  7712.  dbra d1,.fwa
  7713.  add.w #(320-192),a0
  7714.  dbra d0,.fw
  7715.  rts
  7716.  
  7717. DOALLSCREEN:
  7718.  
  7719. fw:
  7720.  move.w #287,d1
  7721. fwa:
  7722.  move.b (a0),d2
  7723.  move.b (a2,d2.w),(a0)+
  7724.  dbra d1,fwa
  7725.  add.w #32,a0
  7726.  dbra d0,fw
  7727.  
  7728. ; move.l frompt,a0
  7729. ; add.l #104*4*60,a0
  7730. ; move.w #31,d0
  7731. ;fw:
  7732. ; move.w d5,d1
  7733. ; move.l a0,a1
  7734. ;fwd:
  7735. ;val SET 104*4*19
  7736. ; REPT 20
  7737. ; and.w #$ff,val(a1)
  7738. ;val SET val-104*4
  7739. ; ENDR
  7740. ; sub.l #104*4*20,a1
  7741. ; dbra d1,fwd
  7742. ; addq #4,a0
  7743. ; dbra d0,fw
  7744. ;
  7745. ; addq #4,a0
  7746. ;
  7747. ; move.w #31,d0
  7748. ;sw:
  7749. ; move.w d5,d1
  7750. ; move.l a0,a1
  7751. ;swd:
  7752. ;val SET 104*4*19
  7753. ; REPT 20
  7754. ; and.w #$ff,val(a1)
  7755. ;val SET val-104*4
  7756. ; ENDR
  7757. ; sub.l #104*4*20,a1
  7758. ; dbra d1,swd
  7759. ; addq #4,a0
  7760. ; dbra d0,sw
  7761. ;
  7762. ; addq #4,a0
  7763. ;
  7764. ; move.w #31,d0
  7765. ;tw:
  7766. ; move.w d5,d1
  7767. ; move.l a0,a1
  7768. ;twd:
  7769. ;val SET 104*4*19
  7770. ; REPT 20
  7771. ; and.w #$ff,val(a1)
  7772. ;val SET val-104*4
  7773. ; ENDR
  7774. ; sub.l #104*4*20,a1
  7775. ; dbra d1,twd
  7776. ; addq #4,a0
  7777. ; dbra d0,tw
  7778. ;
  7779.  rts
  7780.  
  7781. nowaterfull:
  7782.  bset.b #1,$bfe001
  7783.  rts
  7784.  
  7785. prot9: dc.w 0
  7786.  
  7787. ;TempBuffer: ds.l 100 
  7788.  
  7789. prot8: dc.w 0
  7790.  
  7791. ClipTable: ds.l 30
  7792. EndOfClipPt: dc.l 0
  7793. DOUPPER: dc.w 0
  7794.  
  7795. RealTable:
  7796.  dc.l prot1-78935450
  7797.  dc.l prot2-78935450
  7798.  dc.l prot3-78935450
  7799.  dc.l prot4-78935450
  7800.  dc.l prot5-78935450
  7801.  dc.l prot6-78935450
  7802.  dc.l prot7-78935450
  7803.  dc.l prot8-78935450
  7804.  dc.l prot9-78935450
  7805.  dc.l protA-78935450
  7806.  
  7807. dothisroom
  7808.  
  7809.  move.w (a0)+,d0
  7810.  move.w d0,currzone
  7811.  move.w d0,d1
  7812.  muls #40,d1
  7813.  add.l #BIGMAP,d1
  7814.  move.l d1,BIGPTR
  7815.  move.w d0,d1
  7816.  ext.l d1
  7817.  asl.w #2,d1
  7818.  add.l #COMPACTMAP,d1
  7819.  move.l d1,COMPACTPTR
  7820.  add.l #4,d1
  7821.  cmp.l LASTZONE,d1
  7822.  ble.s .nochange
  7823.  move.l d1,LASTZONE
  7824. .nochange:
  7825.  
  7826.  move.l #ZoneBrightTable,a1
  7827.  move.l (a1,d0.w*4),d1
  7828.  tst.b DOUPPER
  7829.  bne.s .okbot
  7830.  swap d1
  7831. .okbot:
  7832.  move.w d1,ZoneBright
  7833.  
  7834. polyloop:
  7835.  move.w (a0)+,d0
  7836.  move.w d0,WALLIDENT
  7837.  and.w #$ff,d0
  7838.  tst.b d0
  7839.  blt jumpoutofloop
  7840.  beq itsawall
  7841.  cmp.w #3,d0
  7842.  beq itsasetclip
  7843.  blt itsafloor
  7844.  cmp.w #4,d0
  7845.  beq itsanobject
  7846.  cmp.w #5,d0
  7847.  beq itsanarc
  7848.  cmp.w #6,d0
  7849.  beq itsalightbeam
  7850.  cmp.w #7,d0
  7851.  beq.s itswater
  7852.  cmp.w #9,d0
  7853.  ble itsachunkyfloor
  7854.  cmp.w #11,d0
  7855.  ble itsabumpyfloor
  7856.  cmp.w #12,d0
  7857.  beq.s itsbackdrop
  7858.  cmp.w #13,d0
  7859.  beq.s itsaseewall
  7860.  
  7861.  bra polyloop
  7862.  
  7863. itsaseewall:
  7864.  st seethru
  7865.  jsr itsawalldraw
  7866.  bra polyloop
  7867.  
  7868. itsbackdrop:
  7869.  jsr putinbackdrop
  7870.  bra polyloop
  7871.  
  7872. itswater:
  7873.  PROTHCHECK
  7874.  move.w #2,SMALLIT
  7875.  move.w #3,d0
  7876.  clr.b gourfloor
  7877.  move.l #FloorLine,LineToUse
  7878.  st usewater
  7879.  clr.b usebumps
  7880.  jsr itsafloordraw
  7881.  bra polyloop
  7882.  
  7883. itsanarc:
  7884.  jsr CurveDraw
  7885.  bra polyloop
  7886.  
  7887. itsanobject:
  7888.  jsr ObjDraw
  7889.  bra polyloop
  7890.  
  7891. itsalightbeam:
  7892.  jsr LightDraw
  7893.  bra polyloop
  7894.  
  7895. itsabumpyfloor:
  7896.  move.w #1,SMALLIT
  7897.  sub.w #9,d0
  7898.  st usebumps
  7899.  st smoothbumps
  7900.  clr.b usewater
  7901.  move.l #BumpLine,LineToUse
  7902.  jsr itsafloordraw
  7903.  bra polyloop
  7904.  
  7905. itsachunkyfloor:
  7906.  move.w #1,SMALLIT
  7907.  subq.w #7,d0
  7908.  st usebumps
  7909.  sub.w #12,topclip
  7910. ; add.w #10,botclip
  7911.  clr.b smoothbumps
  7912.  clr.b usewater
  7913.  move.l #BumpLine,LineToUse
  7914.  jsr itsafloordraw
  7915.  add.w #12,topclip
  7916. ; sub.w #10,botclip
  7917.  bra polyloop 
  7918.  
  7919. itsafloor:
  7920.  
  7921.  move.l PointBrightsPtr,FloorPtBrights
  7922.  
  7923.  move.w currzone,d1
  7924.  muls #80,d1
  7925.  
  7926.  cmp.w #2,d0
  7927.  bne.s .nfl
  7928.  add.l #2,d1
  7929. .nfl
  7930.  add.l d1,FloorPtBrights
  7931.  
  7932.  move.w #1,SMALLIT
  7933.  
  7934.  movem.l a0/d0,-(a7)
  7935.  move.l $4.w,a6
  7936.  jsr _LVOSuperState(a6)
  7937.  move.l d0,SSTACK
  7938.  movem.l (a7)+,a0/d0
  7939.  
  7940.  move.l #FloorLine,LineToUse
  7941. * 1,2 = floor/roof
  7942.  clr.b usewater
  7943.  clr.b usebumps
  7944.  move.b GOURSEL,gourfloor    
  7945.  jsr itsafloordraw
  7946.  move.l a0,-(a7)
  7947.  move.l $4.w,a6
  7948.  move.l SSTACK,d0
  7949.  jsr _LVOUserState(a6)
  7950.  move.l (a7)+,a0
  7951.  bra polyloop
  7952. itsasetclip:
  7953.  bra polyloop
  7954. itsawall:
  7955.  clr.b seethru
  7956. ; move.l #stripbuffer,a1
  7957.  jsr itsawalldraw
  7958.  bra polyloop
  7959.  
  7960. jumpoutofloop:
  7961.  rts
  7962.  
  7963. LASTZONE: dc.l 0
  7964. COMPACTPTR: dc.l 0
  7965. BIGPTR: dc.l 0
  7966. WALLIDENT: dc.w 0
  7967. SMALLIT: dc.w 0
  7968. GOURSEL: dc.w 0
  7969. ThisRoomToDraw: dc.l 0,0
  7970. SplitHeight: dc.l 0
  7971.  
  7972.  include "ab3:source_4000/OrderZones"
  7973.  
  7974. ReadMouse:
  7975.  move.l #$dff000,a6
  7976.  clr.l d0
  7977.  clr.l d1
  7978.  move.w $a(a6),d0
  7979.  lsr.w #8,d0
  7980.  ext.l d0
  7981.  move.w d0,d3
  7982.  move.w oldmy,d2
  7983.  sub.w d2,d0
  7984.  
  7985.  cmp.w #127,d0
  7986.  blt nonegy
  7987.  move.w #255,d1
  7988.  sub.w d0,d1
  7989.  move.w d1,d0
  7990.  neg.w d0
  7991. nonegy:
  7992.  
  7993.  cmp.w #-127,d0
  7994.  bge nonegy2
  7995.  move.w #255,d1
  7996.  add.w d0,d1
  7997.  move.w d1,d0
  7998. nonegy2:
  7999.  
  8000.  add.b d0,d2
  8001.  add.w d0,oldy2
  8002.  move.w d2,oldmy
  8003.  move.w d2,d0
  8004.  
  8005.  move.w oldy2,d0
  8006.  move.w d0,ymouse
  8007.  
  8008.  clr.l d0
  8009.  clr.l d1
  8010.  move.w $a(a6),d0
  8011.  ext.w d0
  8012.  ext.l d0
  8013.  move.w d0,d3
  8014.  move.w oldmx,d2
  8015.  sub.w d2,d0
  8016.  
  8017.  cmp.w #127,d0
  8018.  blt nonegx
  8019.  move.w #255,d1
  8020.  sub.w d0,d1
  8021.  move.w d1,d0
  8022.  neg.w d0
  8023. nonegx:
  8024.  
  8025.  cmp.w #-127,d0
  8026.  bge nonegx2
  8027.  move.w #255,d1
  8028.  add.w d0,d1
  8029.  move.w d1,d0
  8030. nonegx2:
  8031.  
  8032.  add.b d0,d2
  8033.  move.w d0,d1
  8034.  move.w d2,oldmx
  8035.  
  8036.  move.w #$0,$dff034
  8037.  
  8038.  add.w d0,oldx2
  8039.  move.w oldx2,d0
  8040.  and.w #2047,d0
  8041.  move.w d0,oldx2
  8042.  
  8043.  asl.w #2,d0
  8044.  sub.w prevx,d0
  8045.  add.w d0,prevx
  8046.  add.w d0,angpos
  8047.  move.w #0,lrs
  8048.  rts
  8049.  
  8050. noturn:
  8051.  
  8052. ; got to move lr instead. 
  8053.  
  8054. ; d1 = speed moved l/r
  8055.  
  8056.  move.w d1,lrs
  8057.  
  8058.  rts
  8059.  
  8060. lrs: dc.w 0
  8061. prevx: dc.w 0
  8062.  
  8063. angpos: dc.w 0
  8064. mang: dc.w 0
  8065. oldymouse: dc.w 0
  8066. xmouse: dc.w 0
  8067. ymouse: dc.w 0
  8068. oldx2: dc.w 0
  8069. oldmx: dc.w 0
  8070. oldmy: dc.w 0
  8071. oldy2: dc.w 0
  8072.  
  8073. MAPON: dc.w $0
  8074. REALMAPON: dc.w 0
  8075.  
  8076. RotateLevelPts:
  8077.  
  8078.  tst.b REALMAPON
  8079.  beq ONLYTHELONELY
  8080.  
  8081.  move.w sinval,d6
  8082.  swap d6
  8083.  move.w cosval,d6
  8084.  move.l Points,a3
  8085.  move.l #Rotated,a1
  8086.  move.l #OnScreen,a2
  8087.  move.w xoff,d4
  8088.  asr.w #1,d4
  8089.  move.w zoff,d5
  8090.  asr.w #1,d5
  8091. ; move.w #$c40,$dff106
  8092. ; move.w #$f00,$dff180
  8093.  
  8094.  move.w NumLevPts,d7
  8095.  
  8096.  tst.b FULLSCR
  8097.  bne BIGALL
  8098.  
  8099. pointrotlop2:
  8100.  move.w (a3)+,d0
  8101.  asr.w #1,d0
  8102.  sub.w d4,d0
  8103.  move.w d0,d2
  8104.  move.w (a3)+,d1
  8105.  asr.w #1,d1
  8106.  sub.w d5,d1
  8107.  muls d6,d2
  8108.  swap d6
  8109.  move.w d1,d3
  8110.  muls d6,d3
  8111.  sub.l d3,d2
  8112. ; add.l d2,d2
  8113. ; swap d2
  8114. ; ext.l d2
  8115. ; asl.l #7,d2
  8116.  
  8117.  asr.l #7,d2
  8118.  
  8119.  add.l xwobble,d2
  8120.  move.l d2,(a1)+
  8121.  
  8122.  muls d6,d0
  8123.  swap d6
  8124.  muls d6,d1
  8125.  add.l d0,d1
  8126. ; asl.l #2,d1
  8127. ; swap d1
  8128.  
  8129.  asr.l #8,d1
  8130.  asr.l #6,d1
  8131.  
  8132.  move.l d1,(a1)+
  8133.  
  8134.  tst.l d1
  8135.  bgt.s ptnotbehind
  8136.  tst.l d2
  8137.  bgt.s onrightsomewhere
  8138.  move.w #0,d2
  8139.  bra putin
  8140. onrightsomewhere:
  8141.  move.w RIGHTX,d2
  8142.  ext.l d2
  8143.  bra putin
  8144. ptnotbehind:
  8145.  
  8146.  divs.l d1,d2
  8147.  move.w MIDDLEX,d1
  8148.  ext.l d1
  8149.  add.l d1,d2
  8150. putin:
  8151.  move.w d2,(a2)+
  8152.  
  8153.  dbra d7,pointrotlop2
  8154. outofpointrot:
  8155.   rts
  8156.  
  8157.  
  8158. BIGALL:
  8159.  
  8160. pointrotlop2B:
  8161.  move.w (a3)+,d0
  8162.  asr.w #1,d0
  8163.  sub.w d4,d0
  8164.  move.w d0,d2
  8165.  move.w (a3)+,d1
  8166.  asr.w #1,d1
  8167.  sub.w d5,d1
  8168.  muls d6,d2
  8169.  swap d6
  8170.  move.w d1,d3
  8171.  muls d6,d3
  8172.  sub.l d3,d2
  8173. ; add.l d2,d2
  8174. ; swap d2
  8175. ; ext.l d2
  8176. ; asl.l #7,d2
  8177.  asr.l #7,d2
  8178.  add.l xwobble,d2
  8179.  move.l d2,(a1)+
  8180.  
  8181.  muls d6,d0
  8182.  swap d6
  8183.  muls d6,d1
  8184.  add.l d0,d1
  8185.  
  8186.  divs.l #3,d1
  8187.  asr.l #8,d1
  8188.  asr.l #5,d1
  8189.  
  8190. ; asl.l #3,d1
  8191. ; swap d1
  8192. ; ext.l d1
  8193. ; divs #3,d1
  8194.  move.l d1,(a1)+
  8195.  
  8196.  tst.l d1
  8197.  bgt.s ptnotbehindB
  8198.  tst.l d2
  8199.  bgt.s onrightsomewhereB
  8200.  move.l #0,d2
  8201.  bra putinB
  8202. onrightsomewhereB:
  8203.  move.w RIGHTX,d2
  8204.  ext.l d2
  8205.  bra putinB
  8206. ptnotbehindB:
  8207.  
  8208.  divs.l d1,d2
  8209.  move.w MIDDLEX,d1
  8210.  ext.l d1
  8211.  add.l d1,d2
  8212. putinB:
  8213.  move.w d2,(a2)+
  8214.  
  8215.  dbra d7,pointrotlop2B
  8216.   rts
  8217.  
  8218.  
  8219. ONLYTHELONELY:
  8220.  
  8221.  move.w sinval,d6
  8222.  swap d6
  8223.  move.w cosval,d6
  8224.  
  8225.  move.l PointsToRotatePtr,a0
  8226.  move.l Points,a3
  8227.  move.l #Rotated,a1
  8228.  move.l #OnScreen,a2
  8229.  move.w xoff,d4
  8230.  move.w zoff,d5
  8231.  
  8232. ; move.w #$c40,$dff106
  8233. ; move.w #$f00,$dff180
  8234.  
  8235.  tst.b FULLSCR
  8236.  bne BIGLONELY
  8237.  
  8238. pointrotlop:
  8239.  move.w (a0)+,d7
  8240.  blt outofpointrot
  8241.  
  8242.  move.w (a3,d7*4),d0
  8243.  sub.w d4,d0
  8244.  move.w d0,d2
  8245.  move.w 2(a3,d7*4),d1
  8246.  sub.w d5,d1
  8247.  muls d6,d2
  8248.  swap d6
  8249.  move.w d1,d3
  8250.  muls d6,d3
  8251.  sub.l d3,d2
  8252.  add.l d2,d2
  8253.  swap d2
  8254.  ext.l d2
  8255.  asl.l #7,d2
  8256.  add.l xwobble,d2
  8257.  move.l d2,(a1,d7*8)
  8258.  
  8259.  muls d6,d0
  8260.  swap d6
  8261.  muls d6,d1
  8262.  add.l d0,d1
  8263.  asl.l #1,d1
  8264.  swap d1
  8265. ; ext.l d1
  8266. ; divs #3,d1
  8267.  move.l d1,4(a1,d7*8)
  8268.  
  8269.  tst.w d1
  8270.  bgt.s .ptnotbehind
  8271.  tst.w d2
  8272.  bgt.s .onrightsomewhere
  8273.  move.w #0,d2
  8274.  bra .putin
  8275. .onrightsomewhere:
  8276.  move.w RIGHTX,d2
  8277.  bra .putin
  8278. .ptnotbehind:
  8279.  
  8280.  divs d1,d2
  8281.  add.w MIDDLEX,d2
  8282. .putin:
  8283.  move.w d2,(a2,d7*2)
  8284.  
  8285.  bra pointrotlop
  8286.  
  8287. ; move.w #$c40,$dff106
  8288. ; move.w #$ff0,$dff180
  8289.  
  8290.  rts
  8291.  
  8292. BIGLONELY:
  8293.  
  8294. .pointrotlop:
  8295.  move.w (a0)+,d7
  8296.  blt.s .outofpointrot
  8297.  
  8298.  move.w (a3,d7*4),d0
  8299.  sub.w d4,d0
  8300.  move.w d0,d2
  8301.  move.w 2(a3,d7*4),d1
  8302.  sub.w d5,d1
  8303.  muls d6,d2
  8304.  swap d6
  8305.  move.w d1,d3
  8306.  muls d6,d3
  8307.  sub.l d3,d2
  8308.  add.l d2,d2
  8309.  swap d2
  8310.  ext.l d2
  8311.  asl.l #7,d2
  8312.  add.l xwobble,d2
  8313.  move.l d2,(a1,d7*8)
  8314.  
  8315.  muls d6,d0
  8316.  swap d6
  8317.  muls d6,d1
  8318.  add.l d0,d1
  8319.  asl.l #2,d1
  8320.  swap d1
  8321.  ext.l d1
  8322.  divs #3,d1
  8323.  move.l d1,4(a1,d7*8)
  8324.  
  8325.  tst.w d1
  8326.  bgt.s .ptnotbehind
  8327.  tst.w d2
  8328.  bgt.s .onrightsomewhere
  8329.  move.w #0,d2
  8330.  bra .putin
  8331. .onrightsomewhere:
  8332.  move.w RIGHTX,d2
  8333.  bra .putin
  8334. .ptnotbehind:
  8335.  
  8336.  divs d1,d2
  8337.  add.w MIDDLEX,d2
  8338. .putin:
  8339.  move.w d2,(a2,d7*2)
  8340.  
  8341.  bra .pointrotlop
  8342.  
  8343. .outofpointrot:
  8344. ; move.w #$c40,$dff106
  8345. ; move.w #$ff0,$dff180
  8346.  
  8347.  rts
  8348.  
  8349.  
  8350. PLR1_ObjDists
  8351.  ds.w 250
  8352. PLR2_ObjDists
  8353.  ds.w 250
  8354. PLR3_ObjDists
  8355.  ds.w 250
  8356.  
  8357. CalcPLR1InLine:
  8358.  
  8359.  move.w PLR1_sinval,d5
  8360.  move.w PLR1_cosval,d6
  8361.  move.l ObjectData,a4
  8362.  move.l ObjectPoints,a0
  8363.  move.w NumObjectPoints,d7
  8364.  move.l #PLR1_ObsInLine,a2
  8365.  move.l #PLR1_ObjDists,a3
  8366.  
  8367. .objpointrotlop:
  8368.  
  8369.  cmp.b #3,16(a4)
  8370.  beq.s .itaux
  8371.  
  8372.  move.w (a0),d0
  8373.  sub.w PLR1_xoff,d0
  8374.  move.w 4(a0),d1
  8375.  addq #8,a0
  8376.  
  8377.  tst.w 12(a4)
  8378.  blt .noworkout
  8379.  
  8380.  moveq #0,d2
  8381.  move.b 16(a4),d2
  8382.  ;move.l #ColBoxTable,a6
  8383.  ;lea (a6,d2.w*8),a6
  8384.  
  8385.  sub.w PLR1_zoff,d1
  8386.  move.w d0,d2
  8387.  muls d6,d2
  8388.  move.w d1,d3
  8389.  muls d5,d3
  8390.  sub.l d3,d2
  8391.  add.l d2,d2
  8392.  
  8393.  bgt.s .okh
  8394.  neg.l d2
  8395. .okh:
  8396.  swap d2
  8397.  
  8398.  muls d5,d0
  8399.  muls d6,d1
  8400.  add.l d0,d1
  8401.  asl.l #2,d1
  8402.  swap d1
  8403.  moveq #0,d3
  8404.  
  8405.  tst.w d1
  8406.  ble.s .notinline
  8407.  asr.w #1,d2
  8408.  cmp.w #80,d2
  8409.  bgt.s .notinline
  8410.  
  8411.  st d3
  8412. .notinline
  8413.  move.b d3,(a2)+
  8414.  
  8415.  move.w d1,(a3)+
  8416.  
  8417.  add.w #64,a4
  8418.  dbra d7,.objpointrotlop
  8419.  
  8420.  rts
  8421.  
  8422. .itaux:
  8423.  add.w #64,a4
  8424.  bra .objpointrotlop
  8425.  
  8426. .noworkout:
  8427.  move.b #0,(a2)+
  8428.  move.w #0,(a3)+
  8429.  add.w #64,a4
  8430.  dbra d7,.objpointrotlop
  8431.  rts
  8432.  
  8433.  
  8434. CalcPLR2InLine:
  8435.  
  8436.  move.w PLR2_sinval,d5
  8437.  move.w PLR2_cosval,d6
  8438.  move.l ObjectData,a4
  8439.  move.l ObjectPoints,a0
  8440.  move.w NumObjectPoints,d7
  8441.  move.l #PLR2_ObsInLine,a2
  8442.  move.l #PLR2_ObjDists,a3
  8443.  
  8444. .objpointrotlop:
  8445.  
  8446.  cmp.b #3,16(a4)
  8447.  beq.s .itaux
  8448.  
  8449.  move.w (a0),d0
  8450.  sub.w PLR2_xoff,d0
  8451.  move.w 4(a0),d1
  8452.  addq #8,a0
  8453.  
  8454.  tst.w 12(a4)
  8455.  blt .noworkout
  8456.  
  8457.  moveq #0,d2
  8458.  move.b 16(a4),d2
  8459. ; move.l #ColBoxTable,a6
  8460. ; lea (a6,d2.w*8),a6
  8461.  
  8462.  sub.w PLR2_zoff,d1
  8463.  move.w d0,d2
  8464.  muls d6,d2
  8465.  move.w d1,d3
  8466.  muls d5,d3
  8467.  sub.l d3,d2
  8468.  add.l d2,d2
  8469.  
  8470.  bgt.s .okh
  8471.  neg.l d2
  8472. .okh:
  8473.  swap d2
  8474.  
  8475.  muls d5,d0
  8476.  muls d6,d1
  8477.  add.l d0,d1
  8478.  asl.l #2,d1
  8479.  swap d1
  8480.  moveq #0,d3
  8481.  
  8482.  tst.w d1
  8483.  ble.s .notinline
  8484.  asr.w #1,d2
  8485.  cmp.w (a6),d2
  8486.  bgt.s .notinline
  8487.  
  8488.  st d3
  8489. .notinline
  8490.  move.b d3,(a2)+
  8491.  
  8492.  move.w d1,(a3)+
  8493.  
  8494.  add.w #64,a4
  8495.  dbra d7,.objpointrotlop
  8496.  
  8497.  rts
  8498.  
  8499. .itaux:
  8500.  add.w #64,a4
  8501.  bra .objpointrotlop
  8502.  
  8503. .noworkout:
  8504.  move.w #0,(a3)+
  8505.  move.b #0,(a2)+
  8506.  add.w #64,a4
  8507.  dbra d7,.objpointrotlop
  8508.  rts
  8509.  
  8510.  
  8511.  
  8512. CalcPLR3InLine:
  8513.  
  8514.  move.w PLR3_sinval,d5
  8515.  move.w PLR3_cosval,d6
  8516.  move.l ObjectData,a4
  8517.  move.l ObjectPoints,a0
  8518.  move.w NumObjectPoints,d7
  8519.  move.l #PLR3_ObsInLine,a2
  8520.  move.l #PLR3_ObjDists,a3
  8521.  
  8522. .objpointrotlop:
  8523.  
  8524.  cmp.b #3,16(a4)
  8525.  beq.s .itaux
  8526.  
  8527.  move.w (a0),d0
  8528.  sub.w PLR3_xoff,d0
  8529.  move.w 4(a0),d1
  8530.  addq #8,a0
  8531.  
  8532.  tst.w 12(a4)
  8533.  blt .noworkout
  8534.  
  8535.  moveq #0,d2
  8536.  move.b 16(a4),d2
  8537. ; move.l #ColBoxTable,a6
  8538. ; lea (a6,d2.w*8),a6
  8539.  
  8540.  sub.w PLR3_zoff,d1
  8541.  move.w d0,d2
  8542.  muls d6,d2
  8543.  move.w d1,d3
  8544.  muls d5,d3
  8545.  sub.l d3,d2
  8546.  add.l d2,d2
  8547.  
  8548.  bgt.s .okh
  8549.  neg.l d2
  8550. .okh:
  8551.  swap d2
  8552.  
  8553.  muls d5,d0
  8554.  muls d6,d1
  8555.  add.l d0,d1
  8556.  asl.l #2,d1
  8557.  swap d1
  8558.  moveq #0,d3
  8559.  
  8560.  tst.w d1
  8561.  ble.s .notinline
  8562.  asr.w #1,d2
  8563.  cmp.w (a6),d2
  8564.  bgt.s .notinline
  8565.  
  8566.  st d3
  8567. .notinline
  8568.  move.b d3,(a2)+
  8569.  
  8570.  move.w d1,(a3)+
  8571.  
  8572.  add.w #64,a4
  8573.  dbra d7,.objpointrotlop
  8574.  
  8575.  rts
  8576.  
  8577. .itaux:
  8578.  add.w #64,a4
  8579.  bra .objpointrotlop
  8580.  
  8581. .noworkout:
  8582.  move.w #0,(a3)+
  8583.  move.b #0,(a2)+
  8584.  add.w #64,a4
  8585.  dbra d7,.objpointrotlop
  8586.  rts
  8587.  
  8588.  
  8589. RotateObjectPts:
  8590.  
  8591.  move.w sinval,d5
  8592.  move.w cosval,d6
  8593.  
  8594.  move.l ObjectData,a4
  8595.  move.l ObjectPoints,a0
  8596.  move.w NumObjectPoints,d7
  8597.  move.l #ObjRotated,a1
  8598.  
  8599.  tst.b FULLSCR
  8600.  bne BIGOBJPTS
  8601.  
  8602.  
  8603. .objpointrotlop:
  8604.  
  8605.  cmp.b #3,16(a4)
  8606.  beq.s .itaux
  8607.  
  8608.  move.w (a0),d0
  8609.  sub.w xoff,d0
  8610.  move.w 4(a0),d1
  8611.  addq #8,a0
  8612.  
  8613.  tst.w 12(a4)
  8614.  blt .noworkout
  8615.  
  8616.  sub.w zoff,d1
  8617.  
  8618.  move.w d0,d2
  8619.  muls d6,d2
  8620.  move.w d1,d3
  8621.  muls d5,d3
  8622.  sub.l d3,d2
  8623.  
  8624.  
  8625.  add.l d2,d2
  8626.  swap d2
  8627.  move.w d2,(a1)+
  8628.  
  8629.  muls d5,d0
  8630.  muls d6,d1
  8631.  add.l d0,d1
  8632.  asl.l #1,d1
  8633.  swap d1
  8634. ; ext.l d1
  8635. ; divs #3,d1
  8636.  moveq #0,d3
  8637.  
  8638.  move.w d1,(a1)+
  8639.  ext.l d2
  8640.  asl.l #7,d2
  8641.  add.l xwobble,d2
  8642.  move.l d2,(a1)+
  8643.  
  8644.  dbra d7,.objpointrotlop
  8645.  
  8646.  rts
  8647.  
  8648. .itaux:
  8649.  add.w #64,a4
  8650.  bra .objpointrotlop
  8651.  
  8652. .noworkout:
  8653.   move.l #0,(a1)+
  8654.   move.l #0,(a1)+
  8655.   add.w #64,a4
  8656.   dbra d7,.objpointrotlop
  8657.   rts
  8658.   
  8659. BIGOBJPTS:
  8660.  
  8661. .objpointrotlop:
  8662.  
  8663.  cmp.b #3,16(a4)
  8664.  beq.s .itaux
  8665.  
  8666.  move.w (a0),d0
  8667.  sub.w xoff,d0
  8668.  move.w 4(a0),d1
  8669.  addq #8,a0
  8670.  
  8671.  tst.w 12(a4)
  8672.  blt .noworkout
  8673.  
  8674.  sub.w zoff,d1
  8675.  move.w d0,d2
  8676.  muls d6,d2
  8677.  move.w d1,d3
  8678.  muls d5,d3
  8679.  sub.l d3,d2
  8680.  
  8681.  
  8682.  add.l d2,d2
  8683.  swap d2
  8684.  move.w d2,(a1)+
  8685.  
  8686.  muls d5,d0
  8687.  muls d6,d1
  8688.  add.l d0,d1
  8689.  asl.l #2,d1
  8690.  swap d1
  8691.  ext.l d1
  8692.  divs #3,d1
  8693.  moveq #0,d3
  8694.  
  8695.  move.w d1,(a1)+
  8696.  ext.l d2
  8697.  asl.l #7,d2
  8698.  add.l xwobble,d2
  8699.  move.l d2,(a1)+
  8700.  sub.l xwobble,d2
  8701.  
  8702.  add.w #64,a4
  8703.  dbra d7,.objpointrotlop
  8704.  
  8705.  rts
  8706.  
  8707. .itaux:
  8708.  add.w #64,a4
  8709.  bra .objpointrotlop
  8710.  
  8711. .noworkout:
  8712.   move.l #0,(a1)+
  8713.   move.l #0,(a1)+
  8714.   add.w #64,a4
  8715.   dbra d7,.objpointrotlop
  8716.   rts
  8717.  
  8718. LightDraw:
  8719.  
  8720.  move.w (a0)+,d0
  8721.  move.w (a0)+,d1
  8722.  move.l #Rotated,a1
  8723.  move.w 6(a1,d0.w*8),d2
  8724.  ble.s oneendbehind
  8725.  move.w 6(a1,d1.w*8),d3
  8726.  bgt.s bothendsinfront
  8727.  
  8728. oneendbehind:
  8729.  rts
  8730. bothendsinfront:
  8731.  
  8732.  move.l #OnScreen,a2
  8733.  move.w (a2,d0.w*2),d0
  8734.  bge.s okleftend
  8735.  moveq #0,d0
  8736. okleftend:
  8737.  move.w (a2,d1.w*2),d1
  8738.  bgt.s somevis
  8739.  rts
  8740. somevis:
  8741.  cmp.w RIGHTX,d0
  8742.  blt.s somevis2
  8743.  rts
  8744. somevis2:
  8745.  cmp.w RIGHTX,d1
  8746.  blt.s okrightend
  8747.  move.w RIGHTX,d1
  8748.  subq #1,d1
  8749. okrightend:
  8750.  
  8751.  sub.w d0,d1
  8752.  blt.s wrongbloodywayround
  8753.  move.l TexturePal,a4
  8754.  move.l #objintocop,a1
  8755.  lea (a1,d0.w*2),a1
  8756.  
  8757.  move.l frompt,a3
  8758.  move.w #104*4,d6
  8759.  move.w #79,d2
  8760. lacross:
  8761.  move.w d2,d3
  8762.  move.l a3,a2
  8763.  adda.w (a1)+,a2
  8764. ldown:
  8765.  add.w d6,a2
  8766.  move.w (a2),d7
  8767.  move.w (a4,d7.w*2),(a2)
  8768.  dbra d3,ldown
  8769.  dbra d1,lacross
  8770.  
  8771. wrongbloodywayround:
  8772.  
  8773.  rts
  8774.  
  8775. FaceToPlace: dc.w 0
  8776.  
  8777. Cheese:
  8778.  dc.w 4,15
  8779.  
  8780. FacesList:
  8781.  dc.w 0,4*4
  8782.  dc.w 1,2*4
  8783.  dc.w 0,2*4
  8784.  dc.w 2,2*4
  8785.  dc.w 0,2*4
  8786.  dc.w 1,3*4
  8787.  dc.w 0,2*4
  8788.  dc.w 2,3*4
  8789.  dc.w 0,5*4
  8790.  dc.w 1,2*4
  8791.  dc.w 0,2*4
  8792.  dc.w 2,2*4
  8793.  dc.w 0,2*4
  8794.  dc.w 1,2*4
  8795.  dc.w 0,2*4
  8796.  dc.w 2,3*4
  8797.  dc.w 0,1*4
  8798.  dc.w 1,3*4
  8799.  dc.w 0,1*4
  8800.  dc.w 2,3*4
  8801.  dc.w 0,1*4
  8802.  
  8803. EndOfFacesList:
  8804.  
  8805. FacesPtr:
  8806.  dc.l FacesList
  8807. FacesCounter:
  8808.  dc.w 0
  8809. Expression:
  8810.  dc.w 0
  8811.  
  8812.  
  8813. Energy:
  8814.  dc.w 191
  8815. OldEnergy:
  8816.  dc.w 191
  8817. Ammo: dc.w 63
  8818. OldAmmo: dc.w 63
  8819.  
  8820. FullEnergy:
  8821. ; move.w #127,Energy
  8822. ; move.w #127,OldEnergy
  8823. ; move.l #health,a0
  8824. ; move.l #borders,a1
  8825. ; add.l #25*8*2+6,a1
  8826. ; lea 2592(a1),a2
  8827. ; move.w #127,d0
  8828. ;PutInFull:
  8829. ; move.b (a0)+,(a1)
  8830. ; move.b (a0)+,8(a1)
  8831. ; add.w #16,a1
  8832. ; move.b (a0)+,(a2)
  8833. ; move.b (a0)+,8(a2)
  8834. ; add.w #16,a2
  8835. ; dbra d0,PutInFull
  8836.  
  8837.  rts
  8838.  
  8839. ;EnergyBar:
  8840.  
  8841.  move.w Energy,d0
  8842.  bgt.s .noeneg
  8843.  move.w #0,d0
  8844. .noeneg:
  8845.  move.w d0,Energy
  8846.  
  8847.  cmp.w OldEnergy,d0
  8848.  bne.s gottochange
  8849.  
  8850. NoChange
  8851.  rts
  8852.  
  8853. gottochange:
  8854.   
  8855.  blt LessEnergy
  8856.  cmp.w #127,Energy
  8857.  blt.s NotMax
  8858.  move.w #127,Energy
  8859. NotMax:
  8860.  
  8861.  move.w Energy,d0
  8862.  move.w OldEnergy,d2
  8863.  sub.w d0,d2
  8864.  beq.s NoChange    
  8865.  neg.w d2
  8866.  
  8867.  move.w #127,d3
  8868.  sub.w d0,d3
  8869.  
  8870.  move.l #health,a0
  8871.  lea (a0,d3.w*4),a0
  8872. ; move.l #borders+25*16+6,a1
  8873.  lsl.w #4,d3
  8874.  add.w d3,a1
  8875.  lea 2592(a1),a2
  8876.  
  8877. EnergyRise:
  8878.  move.b (a0)+,(a1)
  8879.  move.b (a0)+,8(a1)
  8880.  add.w #16,a1
  8881.  move.b (a0)+,(a2)
  8882.  move.b (a0)+,8(a2)
  8883.  add.w #16,a2
  8884.  subq #1,d2
  8885.  bgt.s EnergyRise
  8886.  
  8887.  move.w Energy,OldEnergy
  8888.  
  8889.  rts 
  8890.  
  8891. LessEnergy: 
  8892.  move.w OldEnergy,d2
  8893.  sub.w d0,d2
  8894.  
  8895.  move.w #127,d3
  8896.  sub.w OldEnergy,d3
  8897.  
  8898. ; move.l #borders+25*16+6,a1
  8899.  asl.w #4,d3
  8900.  add.w d3,a1
  8901.  lea 2592(a1),a2
  8902.  
  8903. EnergyDrain:
  8904.  move.b #0,(a1)
  8905.  move.b #0,8(a1)
  8906.  move.b #0,(a2)
  8907.  move.b #0,8(a2)
  8908.  add.w #16,a1
  8909.  add.w #16,a2
  8910.  subq #1,d2
  8911.  bgt.s EnergyDrain
  8912.  
  8913.  move.w Energy,OldEnergy
  8914.  
  8915.  rts 
  8916.  
  8917. firstdigit: dc.b 0
  8918. secdigit: dc.b 0
  8919. thirddigit: dc.b 0
  8920.  
  8921.  even
  8922.  
  8923. gunny: dc.w 0
  8924.  
  8925. AmmoBar:
  8926.  
  8927. * Do guns first.
  8928.  
  8929.  move.l #borderchars,a4
  8930.  move.b p1_gunselected,d0 
  8931.  move.l #PLAYERONEGUNS,a5
  8932.  cmp.b #'s',mors
  8933.  bne.s .notplr2
  8934.  move.l #PLAYERTWOGUNS,a5
  8935.  move.b p2_gunselected,d0
  8936. .notplr2:
  8937.  
  8938.  move.b d0,gunny
  8939.  
  8940.  move.w #9,d2
  8941.  moveq #0,d0
  8942. putingunnums:
  8943.  move.w #4,d1
  8944.  move.l a4,a0
  8945.  cmp.b gunny,d0
  8946.  bne.s .notsel
  8947.  add.l #5*10*8*2,a0
  8948.  addq #2,a5
  8949.  bra.s .donesel
  8950. .notsel:
  8951.  tst.w (a5)+
  8952.  beq.s .donesel
  8953.  add.l #5*10*8,a0
  8954. .donesel:
  8955.  move.l SCRNDRAWPT,a1
  8956.  add.w d0,a1
  8957.  add.l #3+(240*40),a1
  8958.  bsr DRAWDIGIT
  8959.  addq #1,d0
  8960.  dbra d2,putingunnums
  8961.  
  8962.  move.w Ammo,d0
  8963.  
  8964.  cmp.w #999,d0
  8965.  blt.s .okammo
  8966.  move.w #999,d0 
  8967. .okammo
  8968.  
  8969.  
  8970.  ext.l d0
  8971.  divs #10,d0
  8972.  swap d0
  8973.  move.b d0,thirddigit
  8974.  swap d0
  8975.  ext.l d0
  8976.  divs #10,d0
  8977.  move.b d0,firstdigit
  8978.  swap d0
  8979.  move.b d0,secdigit
  8980.  
  8981.  move.l #borderchars+15*8*10,a0
  8982.  cmp.w #10,Ammo
  8983.  blt.s .notsmallamo
  8984.  add.l #7*8*10,a0
  8985. .notsmallamo:
  8986.  
  8987.  move.l SCRNDRAWPT,a1
  8988.  add.l #20+238*40,a1
  8989.  move.b firstdigit,d0
  8990.  move.w #6,d1
  8991.  bsr DRAWDIGIT
  8992.  
  8993.  move.l SCRNDRAWPT,a1
  8994.  add.l #21+238*40,a1
  8995.  move.b secdigit,d0
  8996.  move.w #6,d1
  8997.  bsr DRAWDIGIT
  8998.  
  8999.  move.l SCRNDRAWPT,a1
  9000.  add.l #22+238*40,a1
  9001.  move.b thirddigit,d0
  9002.  move.w #6,d1
  9003.  bsr DRAWDIGIT
  9004.  
  9005.  rts
  9006.  
  9007. EnergyBar:
  9008.  move.w Energy,d0
  9009.  bge.s .okpo
  9010.  moveq #0,d0 
  9011. .okpo:
  9012.  
  9013.  cmp.w #999,d0
  9014.  blt.s .okenergy
  9015.  move.w #999,d0 
  9016. .okenergy
  9017.  
  9018.  
  9019.  ext.l d0
  9020.  divs #10,d0
  9021.  swap d0
  9022.  move.b d0,thirddigit
  9023.  swap d0
  9024.  ext.l d0
  9025.  divs #10,d0
  9026.  move.b d0,firstdigit
  9027.  swap d0
  9028.  move.b d0,secdigit
  9029.  
  9030.  move.l #borderchars+15*8*10,a0
  9031.  cmp.w #10,Energy
  9032.  blt.s .notsmallamo
  9033.  add.l #7*8*10,a0
  9034. .notsmallamo:
  9035.  
  9036.  move.l SCRNDRAWPT,a1
  9037.  add.l #34+238*40,a1
  9038.  move.b firstdigit,d0
  9039.  move.w #6,d1
  9040.  bsr DRAWDIGIT
  9041.  
  9042.  move.l SCRNDRAWPT,a1
  9043.  add.l #35+238*40,a1
  9044.  move.b secdigit,d0
  9045.  move.w #6,d1
  9046.  bsr DRAWDIGIT
  9047.  
  9048.  move.l SCRNDRAWPT,a1
  9049.  add.l #36+238*40,a1
  9050.  move.b thirddigit,d0
  9051.  move.w #6,d1
  9052.  bsr DRAWDIGIT
  9053.  
  9054.  move.l SCRNSHOWPT,a1
  9055.  add.l #34+238*40,a1
  9056.  move.b firstdigit,d0
  9057.  move.w #6,d1
  9058.  bsr DRAWDIGIT
  9059.  
  9060.  move.l SCRNSHOWPT,a1
  9061.  add.l #35+238*40,a1
  9062.  move.b secdigit,d0
  9063.  move.w #6,d1
  9064.  bsr DRAWDIGIT
  9065.  
  9066.  move.l SCRNSHOWPT,a1
  9067.  add.l #36+238*40,a1
  9068.  move.b thirddigit,d0
  9069.  move.w #6,d1
  9070.  bsr DRAWDIGIT
  9071.  
  9072.  
  9073.  rts
  9074.  
  9075.  
  9076. DRAWDIGIT:
  9077.  ext.w d0
  9078.  lea (a0,d0.w),a2
  9079. charlines:
  9080.  lea 30720(a1),a3 
  9081.  move.b (a2),(a1)
  9082.  move.b 10(a2),10240(a1)
  9083.  move.b 20(a2),20480(a1)
  9084.  move.b 30(a2),(a3)
  9085.  move.b 40(a2),10240(a3)
  9086.  move.b 50(a2),20480(a3)
  9087.  lea 30720(a3),a3
  9088.  move.b 60(a2),(a3)
  9089.  move.b 70(a2),10240(a3)
  9090.  
  9091.  add.w #10*8,a2
  9092.  add.w #40,a1
  9093.  dbra d1,charlines
  9094.  
  9095.  rts
  9096.  
  9097. borderchars: incbin "ab3:includes/bordercharsRAW"
  9098.  
  9099. NARRATOR:
  9100.  
  9101. ; sub.w #1,NARRTIME
  9102. ; bge .NOCHARYET
  9103. ; move.w #3,NARRTIME
  9104.  
  9105.  move.l #SCROLLSCRN,d1
  9106.  move.w d1,scroll
  9107.  swap d1
  9108.  move.w d1,scrolh
  9109.  
  9110.  move.w SCROLLTIMER,d0
  9111.  subq #1,d0
  9112.  move.w d0,SCROLLTIMER
  9113.  cmp.w #40,d0
  9114.  bge .NOCHARYET
  9115.  tst.w d0
  9116.  bge.s .okcha
  9117.  
  9118.  move.w #150,SCROLLTIMER
  9119.  bra .NOCHARYET
  9120.  
  9121. .okcha:
  9122.  
  9123.  move.l #SCROLLSCRN,a0
  9124.  add.w SCROLLXPOS,a0
  9125.  
  9126.  moveq #1,d7
  9127. .doachar: 
  9128.  
  9129.  move.l SCROLLPOINTER,a1
  9130.  moveq #0,d1
  9131.  move.b (a1)+,d1    ; character
  9132.  move.l a1,d2
  9133.  cmp.l ENDSCROLL,d2
  9134.  blt.s .notrestartscroll
  9135.  move.l #BLANKSCROLL,a1
  9136.  move.l #BLANKSCROLL+80,ENDSCROLL
  9137. .notrestartscroll
  9138.  move.l a1,SCROLLPOINTER
  9139.  
  9140.  move.l #SCROLLCHARS,a1
  9141.  asl.w #3,d1
  9142.  add.w d1,a1
  9143.  
  9144.  move.b (a1)+,(a0)
  9145.  move.b (a1)+,80(a0)
  9146.  move.b (a1)+,80*2(a0)
  9147.  move.b (a1)+,80*3(a0)
  9148.  move.b (a1)+,80*4(a0)
  9149.  move.b (a1)+,80*5(a0)
  9150.  move.b (a1)+,80*6(a0)
  9151.  move.b (a1)+,80*7(a0)
  9152.  
  9153.  addq #1,a0
  9154.  dbra d7,.doachar
  9155.  
  9156.  move.w SCROLLXPOS,d0
  9157.  addq #2,d0
  9158.  move.w d0,SCROLLXPOS
  9159.  cmp.w #80,d0
  9160.  blt .NOCHARYET
  9161.  move.w #0,SCROLLXPOS
  9162.  
  9163. .NOCHARYET:
  9164.  rts
  9165.  
  9166. ; cmp.w OldAmmo,d0
  9167. ; bne.s .gottochange
  9168.  
  9169. NARRTIME: dc.w 5
  9170.  
  9171. SCROLLCHARS: incbin "ab3:includes/scrollfont"
  9172.  
  9173. .NoChange
  9174.  rts
  9175.  
  9176. .gottochange:
  9177.   
  9178.  blt LessAmmo
  9179.  cmp.w #63,Ammo
  9180.  blt.s .NotMax
  9181.  move.w #63,Ammo
  9182. .NotMax:
  9183.  
  9184.  move.w Ammo,d0
  9185.  move.w OldAmmo,d2
  9186.  sub.w d0,d2
  9187.  beq.s .NoChange
  9188.  neg.w d2
  9189.  
  9190.  move.w #63,d3
  9191.  sub.w d0,d3
  9192.  
  9193.  move.l #Ammunition,a0
  9194.  lea (a0,d3.w*8),a0
  9195. ; move.l #borders+5184+25*16+1,a1
  9196.  lsl.w #5,d3
  9197.  add.w d3,a1
  9198.  lea 2592(a1),a2
  9199.  
  9200. AmmoRise:
  9201.  move.b (a0)+,(a1)
  9202.  move.b (a0)+,8(a1)
  9203.  add.w #16,a1
  9204.  move.b (a0)+,(a2)
  9205.  move.b (a0)+,8(a2)
  9206.  add.w #16,a2
  9207.  move.b (a0)+,(a1)
  9208.  move.b (a0)+,8(a1)
  9209.  add.w #16,a1
  9210.  move.b (a0)+,(a2)
  9211.  move.b (a0)+,8(a2)
  9212.  add.w #16,a2
  9213.  subq #1,d2
  9214.  bgt.s AmmoRise
  9215.  
  9216.  move.w Ammo,OldAmmo
  9217.  
  9218.  rts 
  9219.  
  9220.  
  9221. LessAmmo: 
  9222.  move.w OldAmmo,d2
  9223.  sub.w d0,d2
  9224.  
  9225.  move.w #63,d3
  9226.  sub.w OldAmmo,d3
  9227.  
  9228. ; move.l #borders++5184+25*16+1,a1
  9229.  asl.w #5,d3
  9230.  add.w d3,a1
  9231.  lea 2592(a1),a2
  9232.  
  9233. AmmoDrain:
  9234.  move.b #0,(a1)
  9235.  move.b #0,8(a1)
  9236.  move.b #0,(a2)
  9237.  move.b #0,8(a2)
  9238.  add.w #16,a1
  9239.  add.w #16,a2
  9240.  move.b #0,(a1)
  9241.  move.b #0,8(a1)
  9242.  move.b #0,(a2)
  9243.  move.b #0,8(a2)
  9244.  add.w #16,a1
  9245.  add.w #16,a2
  9246.  subq #1,d2
  9247.  bgt.s AmmoDrain
  9248.  
  9249.  move.w Ammo,OldAmmo
  9250.  
  9251.  rts 
  9252.  
  9253. nulop:
  9254.  move.w #$0010,$dff000+intreq
  9255.  rte
  9256.  
  9257. doanything: dc.w 0
  9258.  
  9259. end:
  9260. ;     _break #0
  9261.  
  9262.  move.l #$dff000,a6
  9263.  clr.b dosounds
  9264.  clr.b doanything
  9265. waitfortop22:
  9266.  btst.b #0,intreqrl(a6)
  9267.  beq waitfortop22
  9268. waitfortop222:
  9269.  btst.b #0,intreqrl(a6)
  9270.  beq waitfortop222
  9271.  move.w #$f,$dff000+dmacon
  9272.  
  9273.  
  9274.  move.w PLAYERONEHEALTH,Energy
  9275.  cmp.b #'s',mors
  9276.  bne.s .notsl
  9277.  move.w PLAYERTWOHEALTH,Energy
  9278. .notsl:
  9279.  
  9280.  move.l drawpt,d0
  9281.  move.l olddrawpt,drawpt
  9282.  move.l d0,olddrawpt
  9283.  
  9284. ; cmp.b #'b',Prefsfile+3
  9285. ; bne.s .noback
  9286. ; jsr mt_end
  9287. ;.noback
  9288.  
  9289.  tst.w Energy
  9290.  bgt.s wevewon
  9291.  move.w #0,Energy
  9292.  bsr EnergyBar
  9293.  
  9294.  move.l #gameover,mt_data
  9295.  st UseAllChannels
  9296.  clr.b reachedend
  9297.  jsr mt_init
  9298. playgameover:
  9299.  move.l #$dff000,a6
  9300. waitfortop2:
  9301.  
  9302.     
  9303.  btst.b #0,intreqrl(a6)
  9304.  beq waitfortop2
  9305.  move.w #$1,intreq(a6)
  9306.  
  9307.     
  9308.  jsr mt_music
  9309.  
  9310.  
  9311.     
  9312.  tst.b reachedend
  9313.  beq.s playgameover
  9314.  
  9315.  bra wevelost
  9316.  
  9317.  
  9318. wevewon:
  9319.  
  9320.  move.w #$f,$dff000+dmacon
  9321.  
  9322.  bsr EnergyBar
  9323.  
  9324.  cmp.b #'n',mors
  9325.  bne.s .nonextlev
  9326.  add.w #1,MAXLEVEL
  9327.  st FINISHEDLEVEL
  9328.  
  9329. .nonextlev:
  9330.  
  9331.  move.l #welldone,mt_data
  9332.  st UseAllChannels
  9333.  clr.b reachedend
  9334.  
  9335.  jsr mt_init
  9336. playwelldone:
  9337.  move.l #$dff000,a6
  9338. waitfortop3:
  9339.  btst.b #0,intreqrl(a6)
  9340.  beq waitfortop3
  9341.  move.w #$1,intreq(a6)
  9342.  
  9343.  jsr mt_music
  9344.  
  9345.  tst.b reachedend
  9346.  beq.s playwelldone
  9347.  
  9348.  cmp.b #'n',mors
  9349.  bne.s wevelost
  9350.  cmp.w #16,MAXLEVEL
  9351.  bne.s wevelost
  9352.  
  9353.  jmp ENDGAMESCROLL
  9354.  
  9355. wevelost:
  9356.  
  9357.  move.w #$f,$dff000+dmacon
  9358.  PROTICHECK a0
  9359.  
  9360.  jmp closeeverything 
  9361.  
  9362. endnomusic
  9363.  clr.b doanything
  9364.  
  9365.  
  9366. ; cmp.b #'b',Prefsfile+3
  9367. ; bne.s .noback
  9368. ; jsr mt_end
  9369. ;.noback
  9370. *******************************
  9371. ; cmp.b #'n',mors
  9372. ; bne.s .nonextlev
  9373. ; cmp.w #15,MAXLEVEL
  9374. ; bge.s .nonextlev
  9375. ; add.w #1,MAXLEVEL
  9376. ; st FINISHEDLEVEL
  9377. ;.nonextlev:
  9378. ******************************
  9379.  
  9380.  jmp closeeverything
  9381.  
  9382. do32:
  9383.  move.w #31,d7
  9384.  move.w #$180,d1
  9385. across:
  9386.  move.w d1,(a1)+
  9387.  move.w d1,(a3)+
  9388.  move.w #0,(a1)+ 
  9389.  move.w #0,(a3)+
  9390.  add.w #2,d1
  9391.  dbra d7,across
  9392.  rts
  9393.  
  9394. ;string:
  9395. ;    dc.b    'credits',0
  9396.  
  9397. ENDGAMESCROLL:
  9398.  move.l LEVELMUSIC,mt_data
  9399.  clr.b UseAllChannels
  9400.  jsr mt_init
  9401.  
  9402.  move.w #$fff,MIXCOLL
  9403.  
  9404.  move.w #$1cc1,BOTOFTXT
  9405.  
  9406.  jsr CLRTWEENSCRN
  9407.  
  9408.  move.l #TEXTCOP,$dff080
  9409.  
  9410.  move.l #ENDGAMETEXTy,a0
  9411.  
  9412.  
  9413. SCROLLUP16LINES:
  9414.  
  9415.  move.w #15,d0
  9416.  
  9417. do16
  9418.  move.l #$dff000,a6
  9419.  
  9420.  move.w #0,d6
  9421.  move.w #7,d7
  9422.  
  9423.  move.l #SCROLLSHADES,a5
  9424.  
  9425. fadeupp:
  9426.  
  9427.  move.w (a5,d6.w*2),TOPCOLL
  9428.  move.w (a5,d7.w*2),TXTCOLL
  9429.  
  9430.  
  9431. .wtup
  9432.  btst #5,intreqrl(a6)
  9433.  beq.s .wtup
  9434.  move.w #$20,intreq(a6)
  9435.  
  9436.  jsr mt_music
  9437.  
  9438.  add.w #1,d6
  9439.  sub.w #1,d7
  9440.  bne fadeupp
  9441.  
  9442. .wtup2
  9443.  btst #5,intreqrl(a6)
  9444.  beq.s .wtup2
  9445.  move.w #$20,intreq(a6)
  9446.  
  9447.  move.w #0,TOPCOLL
  9448.  move.w #$fff,TXTCOLL
  9449.  
  9450.  WB
  9451.  
  9452.  move.l TEXTSCRN,d1
  9453.  move.l d1,bltdpt(a6)
  9454.  add.l #80,d1
  9455.  move.l d1,bltapt(a6)
  9456.  move.w #$09f0,bltcon0(a6)
  9457.  move.w #$0,bltcon1(a6)
  9458.  move.w #0,bltdmod(a6)
  9459.  move.w #0,bltamod(a6)
  9460.  move.l #-1,bltafwm(a6)
  9461.  
  9462.  move.w #255*64+40,bltsize(a6)
  9463.  
  9464.  WB
  9465.  
  9466.  dbra d0,do16
  9467.  
  9468.  move.l TEXTSCRN,a1
  9469.  move.w #15,d0
  9470.  jsr DRAWLINEOFTEXT
  9471.  
  9472.  add.l #82,a0
  9473.  cmp.l #ENDENDGAMETEXT,a0
  9474.  blt SCROLLUP16LINES
  9475.  
  9476.  move.l #ENDGAMETEXTy,a0
  9477.  bra SCROLLUP16LINES
  9478.  
  9479. SCROLLSHADES:
  9480.  dc.w 0
  9481.  dc.w $333
  9482.  dc.w $666
  9483.  dc.w $888
  9484.  dc.w $aaa
  9485.  dc.w $ccc
  9486.  dc.w $ddd
  9487.  dc.w $eee
  9488.  
  9489. ENDGAMETEXTy:
  9490. ;          12345678901234567890123456789012345678901234567890123456789012345678901234567890
  9491.  dc.b 0,0,"                                                                                "
  9492.  dc.b 0,1,"As the beast and its four servants die, a breathless silence falls, broken      "
  9493.  dc.b 0,1,"only by the hammering of my own heart in my chest.                              "
  9494.  dc.b 0,1,"I run to the now open exit, and out into the maze of corridors through which I  "
  9495.  dc.b 0,1,"came. I encounter many, many aliens, lying twitching on the ground, or utterly  "
  9496.  dc.b 0,1,"still with glazed eyes and green froth drying on their lips. Many seem to have  "
  9497.  dc.b 0,1,"turned their weapons on themselves, unable to bear either the pain or the       "
  9498.  dc.b 0,1,"sudden silence in their minds.                                                  "
  9499.  dc.b 0,0,"                                                                                "
  9500.  dc.b 0,1,"It takes me several hours to locate a working teleport to take me back aboard   "
  9501.  dc.b 0,1,"the orbiting alien ship. The scene there is the same; hordes of aliens, either  "
  9502.  dc.b 0,1,"dead or catatonic, I cannot tell.                                               "
  9503.  dc.b 0,1,"I walk slowly, exhausted, back to the INDOMITABLE, averting my eyes from the    "
  9504.  dc.b 0,1,"pitiful scenes around me. I know that my work is not finished yet.              "
  9505.  dc.b 0,1,"Once aboard, I make my way to the bridge. I manage to restart the main power    "
  9506.  dc.b 0,1,"generators and get basic navigation back on-line. Working from the memories     "
  9507.  dc.b 0,1,"implanted by the dying marine, I painstakingly program the computer to deal     "
  9508.  dc.b 0,1,"the killing blow to the enemy. At last the task is finished. The ship hums into "
  9509.  dc.b 0,1,"life, accellerating slowly out of orbit, towing the massive alien craft and     "
  9510.  dc.b 0,1,"its mindless cargo behind it.                                                   "
  9511.  dc.b 0,1,"As the image of the alien sun grows in the viewscreen, I think about what I     "
  9512.  dc.b 0,1,"have seen. Fragments of technology, stolen from civilisations - how long ago?   "
  9513.  dc.b 0,1,"How long since they were exterminated by these parasites? And how many more     "
  9514.  dc.b 0,1,"if they are allowed to continue?                                                "
  9515.  dc.b 0,1,"The sun looms hideously large before me, seeming at the last moment to slip to  "
  9516.  dc.b 0,1,"one side as the cruiser slingshots itself through the immense gravity well,     "
  9517.  dc.b 0,1,"its speed doubling and doubling again. The ship shudders and groans as the      "
  9518.  dc.b 0,1,"ponderous mass of the alien ship tries to tear itself free. I feel a distant    "
  9519.  dc.b 0,1,"twinge of curiosity as to whether it will succeed.                              "
  9520.  dc.b 0,1,"The navigation computer chatters quietly to itself as it makes tiny             "
  9521.  dc.b 0,1,"course corrections, bringing the payload to bear on its target. I only sit,     "
  9522.  dc.b 0,1,"watching blankly as we hurtle back towards the planet. The navicom beeps        "
  9523.  dc.b 0,1,"quietly to signal the blowing of the explosive bolts holding the docking ring.  "
  9524.  dc.b 0,1,"So great is our speed that the alien ship does not receed, but simply vanishes  "
  9525.  dc.b 0,1,"from sight, tracked only on the readouts of the computers in front of me.       "
  9526.  dc.b 0,1,"One readout in particular occupies my attention. Red numbers spin towards zero  "
  9527.  dc.b 0,1,"as my invisible agent of destruction spins towards oblivion. Three digits, now  "
  9528.  dc.b 0,1,"two, and now only one. I shift my attention to the image of the alien world,    "
  9529.  dc.b 0,1,"receeding behind my ship.                                                       "
  9530.  dc.b 0,0,"                                                                                "
  9531.  dc.b 0,1,"Three...                                                                        "
  9532.  dc.b 0,0,"                                                                                "
  9533.  dc.b 0,1,"Two...                                                                          "
  9534.  dc.b 0,0,"                                                                                "
  9535.  dc.b 0,1,"One...                                                                          "
  9536.  dc.b 0,0,"                                                                                "
  9537.  dc.b 0,1,"Zero.                                                                           "
  9538.  dc.b 0,0,"                                                                                "
  9539.  dc.b 0,0,"                                                                                "
  9540.  dc.b 0,0,"                                                                                "
  9541.  dc.b 0,0,"                                                                                "
  9542.  dc.b 0,1,"Travelling at nearly a quarter of the speed of light, the alien ship smashed    "
  9543.  dc.b 0,1,"into the planet, flashing past the useless orbital defences which should have   "
  9544.  dc.b 0,1,"neutralized it millions of miles earlier. It passed through the twenty miles    "
  9545.  dc.b 0,1,"of atmosphere in a little more than one ten-thousandth of a second. The air     "
  9546.  dc.b 0,1,"directly beneath had no time to be pushed out of the way, and in another        "
  9547.  dc.b 0,1,"tenth of a second it was a molecule-thick layer a thousand miles below the      "
  9548.  dc.b 0,1,"planet's surface.                                                               "
  9549.  dc.b 0,1,"Such was the heat and pressure caused by the impact, that part of the molten    "
  9550.  dc.b 0,1,"core of the planet underwent nuclear fusion, vapourising thousands of billions  "
  9551.  dc.b 0,1,"of tonnes of surrounding material. This expanding superhot plasma cloud forced  "
  9552.  dc.b 0,1,"its way up through the mantle and crust, fracturing the surface of the planet,  "
  9553.  dc.b 0,1,"blowing continent-sized chunks into space and heating the tortured atmosphere   "
  9554.  dc.b 0,1,"to ignition point. Within two minutes of impact, the doomed planet was a        "
  9555.  dc.b 0,1,"misshapen, incandescent ball, with burning fragments spinning deceptively       "
  9556.  dc.b 0,1,"slowly in their brief orbits before re-impacting with fantastic, majestic       "
  9557.  dc.b 0,1,"force.                                                                          "
  9558.  dc.b 0,0,"                                                                                "
  9559.  dc.b 0,0,"                                                                                "
  9560.  dc.b 0,0,"                                                                                "
  9561.  dc.b 0,0,"                                                                                "
  9562.  dc.b 0,1,"In a matter of weeks, the small amount of matter which had undergone fusion     "
  9563.  dc.b 0,1,"burned itself out, but the planet still glowed sullenly from a million cracks   "
  9564.  dc.b 0,1,"and holes in the crust, as it would continue to do for millions of years to     "
  9565.  dc.b 0,1,"come. The world was barren and dead, and the creatures who once roamed its      "
  9566.  dc.b 0,1,"surface no more than a memory in the mind of one man, sleeping dreamlessly      "
  9567.  dc.b 0,1,"as the invisible speck of his ship sped silently on, towards home.              "
  9568.  dc.b 0,0,"                                                                                "
  9569.  dc.b 0,0,"                                                                                "
  9570.  dc.b 0,0,"                                                                                "
  9571.  dc.b 0,0,"                                                                                "
  9572.  dc.b 0,0,"                                                                                "
  9573.  dc.b 0,0,"                                                                                "
  9574.  dc.b 0,0,"                                                                                "
  9575.  dc.b 0,0,"                                                                                "
  9576.  dc.b 0,0,"                                                                                "
  9577.  dc.b 0,0,"                                                                                "
  9578.  dc.b 0,0,"                                                                                "
  9579.  dc.b 0,0,"                                                                                "
  9580.  dc.b 0,0,"                                                                                "
  9581.  dc.b 0,0,"                                                                                "
  9582.  dc.b 0,0,"                                                                                "
  9583.  dc.b 0,0,"                                                                                "
  9584.  dc.b 0,1,"ALIEN BREED 3D II                                                               "
  9585.  dc.b 0,1,"THE KILLING GROUNDS                                                             "
  9586.  dc.b 0,0,"                                                                                "
  9587.  dc.b 0,0,"                                                                                "
  9588.  dc.b 0,1,"A Team 17 Game                                                                  "
  9589.  dc.b 0,0,"                                                                                "
  9590.  dc.b 0,1,"Produced in association with OCEAN Software                                     "
  9591.  dc.b 0,0,"                                                                                "
  9592.  dc.b 0,0,"                                                                                "
  9593.  dc.b 0,1,"Game Design, Game Code, Editor Code and In-Game Text                            "
  9594.  dc.b 0,0,"                                                                                "
  9595.  dc.b 0,1,"Andrew Clitheroe                                                                "
  9596.  dc.b 0,0,"                                                                                "
  9597.  dc.b 0,0,"                                                                                "
  9598.  dc.b 0,1,"Graphics                                                                        "
  9599.  dc.b 0,0,"                                                                                "
  9600.  dc.b 0,1,"Michael Green                                                                   "
  9601.  dc.b 0,0,"                                                                                "
  9602.  dc.b 0,0,"                                                                                "
  9603.  dc.b 0,1,"3D Object Designs, 3D Editors, Serial and OS code                               "
  9604.  dc.b 0,0,"                                                                                "
  9605.  dc.b 0,1,"Charles Blessing                                                                "
  9606.  dc.b 0,0,"                                                                                "
  9607.  dc.b 0,0,"                                                                                "
  9608.  dc.b 0,1,"Music                                                                           "
  9609.  dc.b 0,0,"                                                                                "
  9610.  dc.b 0,1,"Ben Chanter                                                                     "
  9611.  dc.b 0,0,"                                                                                "
  9612.  dc.b 0,0,"                                                                                "
  9613.  dc.b 0,1,"Project Manager                                                                 "
  9614.  dc.b 0,0,"                                                                                "
  9615.  dc.b 0,1,"Phil Quirke-Webster                                                             "
  9616.  dc.b 0,0,"                                                                                "
  9617.  dc.b 0,0,"                                                                                "
  9618.  dc.b 0,1,"Playtesting                                                                     "
  9619.  dc.b 0,0,"                                                                                "
  9620.  dc.b 0,1,"Phil and the Wolves                                                             "
  9621.  dc.b 0,0,"                                                                                "
  9622.  dc.b 0,0,"                                                                                "
  9623.  dc.b 0,1,"Additional Graphics                                                             "
  9624.  dc.b 0,0,"                                                                                "
  9625.  dc.b 0,1,"Pete Lyons                                                                      "
  9626.  dc.b 0,0,"                                                                                "
  9627.  dc.b 0,0,"                                                                                "
  9628.  
  9629.  
  9630. ENDENDGAMETEXT:
  9631.  
  9632.  
  9633. ;
  9634. ;    move.l    4.w,a6
  9635. ;    move.l    #string,d1
  9636. ;    moveq    #0,d2
  9637. ;    moveq    #0,d3
  9638. ;    jsr    _LVOExecute(a6)
  9639.  
  9640. ; include "endscroll.s"
  9641.  
  9642. ***********************************
  9643.  include "ab3:source_4000/CD32JOY"
  9644.  
  9645.  
  9646.  
  9647. *************************************
  9648. * Set left and right clip values
  9649. *************************************
  9650.  
  9651.  
  9652.  
  9653. NEWsetlclip:
  9654.  move.l #OnScreen,a1
  9655.  move.l #Rotated,a2
  9656.  move.l CONNECT_TABLE,a3
  9657.  move.l Points,a4
  9658.  
  9659.  move.w (a0),d0
  9660.  bge.s .notignoreleft
  9661.  
  9662. ; move.l #0,(a6)
  9663.  
  9664.  bra .leftnotoktoclip
  9665. .notignoreleft:
  9666.  
  9667.  move.w 6(a2,d0*8),d3    ; left z val
  9668.  bgt.s .leftclipinfront
  9669.  addq #2,a0
  9670.  rts
  9671.  
  9672.  tst.w 6(a2,d0*8)
  9673.  bgt.s .leftnotoktoclip
  9674. .ignoreboth:
  9675. ; move.l #0,(a6)
  9676. ; move.l #96*65536,4(a6)
  9677.  move.w #0,leftclip
  9678.  move.w RIGHTX,rightclip
  9679.  addq #8,a6
  9680.  addq #2,a0
  9681.  rts
  9682.  
  9683. .leftclipinfront:
  9684.  move.w (a1,d0*2),d1    ; left x on screen
  9685.  move.w (a0),d2
  9686.  move.w 2(a3,d2.w*4),d2
  9687.  move.w (a1,d2.w*2),d2
  9688.  cmp.w d1,d2
  9689.  bgt.s .leftnotoktoclip
  9690.  
  9691.  
  9692. *************************************
  9693.  
  9694. ; move.w 2(a3,d0.w*4),d6
  9695. ; move.w (a4,d0.w*4),d2
  9696. ; move.w 2(a4,d0.w*4),d3
  9697. ; move.w (a4,d6.w*4),d4
  9698. ; move.w 2(a4,d6.w*4),d5
  9699. ;
  9700. ; sub.w d2,d4    ;dx
  9701. ; sub.w d3,d5    ;dz
  9702. ; move.w xoff,d0
  9703. ; move.w zoff,d6
  9704. ; sub.w d2,d0
  9705. ; sub.w d3,d6
  9706. ; muls d0,d4
  9707. ; muls d6,d5
  9708. ; add.l d4,d5
  9709. ; bge.s .leftnotoktoclip
  9710.  
  9711. *************************************
  9712.  
  9713.  
  9714.  
  9715. ; move.w d1,(a6)
  9716. ; move.w d3,2(a6)
  9717.  cmp.w leftclip,d1
  9718.  ble.s .leftnotoktoclip
  9719.  move.w d1,leftclip
  9720. .leftnotoktoclip:
  9721.  
  9722.  addq #2,a0
  9723.  
  9724.  rts
  9725.  
  9726. NEWsetrclip
  9727.  move.l #OnScreen,a1
  9728.  move.l #Rotated,a2
  9729.  move.l CONNECT_TABLE,a3
  9730.  move.w (a0),d0
  9731.  bge.s .notignoreright
  9732. ; move.w #96,4(a6)
  9733. ; move.w #0,6(a6)
  9734.  move.w #0,d4
  9735.  bra .rightnotoktoclip
  9736. .notignoreright:
  9737.  move.w 6(a2,d0*8),d4    ; right z val
  9738.  bgt.s .rightclipinfront
  9739. ; move.w #96,4(a6)
  9740. ; move.w #0,6(a6)
  9741.  bra.s .rightnotoktoclip
  9742.  
  9743. .rightclipinfront:
  9744.  move.w (a1,d0*2),d1    ; right x on screen
  9745.  move.w (a0),d2
  9746.  move.w (a3,d2.w*4),d2
  9747.  move.w (a1,d2.w*2),d2
  9748.  cmp.w d1,d2
  9749.  blt.s .rightnotoktoclip
  9750. ; move.w d1,4(a6)
  9751. ; move.w d4,6(a6)
  9752.  
  9753.  
  9754. *************************************
  9755.  
  9756. ; move.w (a3,d0.w*4),d6
  9757. ; move.w (a4,d0.w*4),d2
  9758. ; move.w 2(a4,d0.w*4),d3
  9759. ; move.w (a4,d6.w*4),d4
  9760. ; move.w 2(a4,d6.w*4),d5
  9761. ;
  9762. ; sub.w d2,d4    ;dx
  9763. ; sub.w d3,d5    ;dz
  9764. ; move.w xoff,d0
  9765. ; move.w zoff,d6
  9766. ; sub.w d2,d0
  9767. ; sub.w d3,d6
  9768. ; muls d0,d4
  9769. ; muls d6,d5
  9770. ; add.l d4,d5
  9771. ; ble.s .rightnotoktoclip
  9772.  
  9773. *************************************
  9774.  
  9775.  
  9776.  
  9777.  cmp.w rightclip,d1
  9778.  bge.s .rightnotoktoclip
  9779.  addq #1,d1
  9780.  move.w d1,rightclip
  9781. .rightnotoktoclip:
  9782.  addq #8,a6
  9783.  addq #2,a0
  9784.  rts
  9785.  
  9786. FIRSTsetlrclip:
  9787.  move.l #OnScreen,a1
  9788.  move.l #Rotated,a2
  9789.  
  9790.  move.w (a0)+,d0
  9791.  bge.s .notignoreleft
  9792.  bra .leftnotoktoclip
  9793. .notignoreleft:
  9794.  
  9795.  move.w 6(a2,d0*8),d3    ; left z val
  9796.  bgt.s .leftclipinfront
  9797.  
  9798.  move.w (a0),d0
  9799.  blt.s .ignoreboth
  9800.  tst.w 6(a2,d0*8)
  9801.  bgt.s .leftnotoktoclip
  9802. .ignoreboth
  9803.  move.w RIGHTX,rightclip
  9804.  move.w #0,leftclip
  9805.  addq #2,a0
  9806.  rts
  9807.  
  9808. .leftclipinfront:
  9809.  move.w (a1,d0*2),d1    ; left x on screen
  9810.  cmp.w leftclip,d1
  9811.  ble.s .leftnotoktoclip
  9812.  move.w d1,leftclip
  9813. .leftnotoktoclip:
  9814.  
  9815.  move.w (a0)+,d0
  9816.  bge.s .notignoreright
  9817.  move.w #0,d4
  9818.  bra .rightnotoktoclip
  9819. .notignoreright:
  9820.  move.w 6(a2,d0*8),d4    ; right z val
  9821.  ble.s .rightnotoktoclip
  9822.  
  9823. .rightclipinfront:
  9824.  move.w (a1,d0*2),d1    ; right x on screen
  9825.  addq #1,d1
  9826.  cmp.w rightclip,d1
  9827.  bge.s .rightnotoktoclip
  9828.  move.w d1,rightclip
  9829. .rightnotoktoclip:
  9830.  
  9831. ; move.w leftclip,d0
  9832. ; move.w rightclip,d1
  9833. ; cmp.w d0,d1
  9834. ; bge.s .noswap
  9835. ; move.w #192,rightclip
  9836. ; move.w #0,leftclip
  9837. ;.noswap:
  9838.  
  9839.  rts
  9840.  
  9841.  
  9842. leftclip2: dc.w 0
  9843. rightclip2: dc.w 0
  9844. ZoneBright: dc.w 0
  9845.  
  9846. npolys: dc.w 0
  9847.  
  9848. PLR1_fire: dc.b 0
  9849. PLR2_fire: dc.b 0
  9850. PLR3_fire: dc.b 0
  9851.  
  9852. *****************************************************
  9853.  
  9854.  
  9855. pastdata:
  9856. ***********************************
  9857. * This routine animates brightnesses.
  9858.  
  9859.  
  9860. liftpt: dc.l liftanimtab
  9861.  
  9862. brightpt:
  9863.  dc.l brightanimtab
  9864.  
  9865.  
  9866. liftanim:
  9867.  rts
  9868.  
  9869. ******************************
  9870.  include "ab3:source_4000/ObjectMove"
  9871.  include "ab3:source_4000/MultiAnims"
  9872.  include "ab3:source_4000/airoutine.s"
  9873. ******************************
  9874. startpass:
  9875. ; include "ab3:source_4000/password_reloc.s"
  9876. endpass:
  9877.  
  9878. rotanimpt: dc.w 0
  9879. xradd: dc.w 5
  9880. yradd: dc.w 8
  9881. xrpos: dc.w 320
  9882. yrpos: dc.w 320
  9883.  
  9884. rotanim:
  9885.  rts
  9886.  
  9887. option:
  9888.  dc.l 0,0
  9889.  
  9890. ********** WALL STUFF *******************************
  9891.  
  9892.  include "AB3:source_4000/hireswall.s"
  9893.  include "AB3:source_4000/hiresgourwall.s"
  9894.  
  9895. *****************************************************
  9896.  
  9897. ******************************************
  9898. * floor polygon
  9899.  
  9900. numsidestd: dc.w 0
  9901. bottomline: dc.w 0
  9902.  
  9903. checkforwater:
  9904.  tst.b usewater
  9905.  beq.s .notwater
  9906.  
  9907.  move.l Roompt,a1
  9908.  move.w (a1),d7
  9909.  cmp.w currzone,d7
  9910.  bne.s .notwater
  9911.  
  9912.  move.b #$f,fillscrnwater
  9913.  
  9914. .notwater:
  9915.  move.w (a0)+,d6    ; sides-1
  9916.  add.w d6,d6
  9917.  add.w d6,a0
  9918.  add.w #4+6,a0
  9919.  rts
  9920.  
  9921.  rts
  9922.  
  9923. ;NewCornerBuff:
  9924. ; ds.l 100
  9925. CLRNOFLOOR: dc.w 0
  9926.  
  9927. itsafloordraw:
  9928.  
  9929. * If D0 =1 then its a floor otherwise (=2) it's
  9930. * a roof.
  9931.  
  9932.  move.w #0,above
  9933.  move.w (a0)+,d6    ; ypos of poly
  9934.  
  9935.  tst.b usewater
  9936.  beq.s .oknon
  9937.  tst.b DOANYWATER
  9938.  beq dontdrawreturn
  9939. .oknon
  9940.  
  9941.  move.w d6,d7
  9942.  ext.l d7
  9943.  asl.l #6,d7
  9944.  cmp.l TOPOFROOM,d7
  9945.  blt checkforwater
  9946.  cmp.l BOTOFROOM,d7
  9947.  bgt.s dontdrawreturn
  9948.  
  9949.  move.w leftclip,d7
  9950.  cmp.w rightclip,d7
  9951.  bge.s dontdrawreturn
  9952.  
  9953.  sub.w flooryoff,d6
  9954.  bgt.s below
  9955.  blt.s aboveplayer
  9956.  
  9957.  tst.b usewater
  9958.  beq.s .notwater
  9959.  
  9960.  move.l Roompt,a1
  9961.  move.w (a1),d7
  9962.  cmp.w currzone,d7
  9963.  
  9964.  bne.s .notwater
  9965.  
  9966.  st fillscrnwater
  9967.  
  9968. .notwater:
  9969.  
  9970.  
  9971. dontdrawreturn:
  9972.  move.w (a0)+,d6    ; sides-1
  9973.  add.w d6,d6
  9974.  add.w d6,a0
  9975.  add.w #4+6,a0
  9976.  rts
  9977. aboveplayer:
  9978.  
  9979.  tst.b usewater
  9980.  beq.s .notwater
  9981.  
  9982.  move.l Roompt,a1
  9983.  move.w (a1),d7
  9984.  cmp.w currzone,d7
  9985.  bne.s .notwater
  9986.  
  9987.  move.b #$f,fillscrnwater
  9988.  
  9989. .notwater:
  9990.  
  9991.  btst #1,d0
  9992.  beq.s dontdrawreturn
  9993.  move.w MIDDLEY,d7
  9994.  sub.w topclip,d7 
  9995.  ble.s dontdrawreturn
  9996.  move.w #1,d0
  9997.  move.w d0,above
  9998.  neg.w d6
  9999.  bra.s notbelow
  10000. below:
  10001.  move.w botclip,d7
  10002.  sub.w MIDDLEY,d7
  10003.  ble.s dontdrawreturn
  10004. notbelow:
  10005.  btst #0,d0
  10006.  beq.s dontdrawreturn
  10007.  move.w d6,distaddr
  10008.  muls #64,d6
  10009.  move.l d6,ypos
  10010.  ext.l d7
  10011.  divs.l d7,d6        ; zpos of bottom
  10012.             ; visible line
  10013.  
  10014.  beq dontdrawreturn
  10015.  
  10016.  cmp.l #32767,d6
  10017.  bgt dontdrawreturn
  10018.             
  10019.  move.w d6,minz
  10020.  move.w d7,bottomline
  10021.  
  10022. ; Go round each point finding out
  10023. ; if it should be visible or not.
  10024.  
  10025.  move.l a0,-(a7)
  10026.  
  10027.  move.w (a0)+,d7    ; number of sides
  10028.  move.l #Rotated,a1
  10029.  move.l #OnScreen,a2
  10030. ; move.l #NewCornerBuff,a3
  10031.  moveq #0,d4
  10032.  moveq #0,d5
  10033.  moveq #0,d6
  10034.  clr.b anyclipping
  10035.  
  10036. cornerprocessloop:
  10037.  
  10038.  move.w (a0)+,d0
  10039.  and.w #$fff,d0
  10040.  move.w 6(a1,d0.w*8),d1
  10041.  ble  .canttell
  10042.  
  10043.  move.w (a2,d0.w*2),d3
  10044.  cmp.w leftclip,d3
  10045.  bgt.s .nol
  10046.  st d4
  10047.  st anyclipping
  10048.  bra.s .nos
  10049. .nol:
  10050.  cmp.w rightclip,d3
  10051.  blt.s .nor
  10052.  st d6
  10053.  st anyclipping
  10054.  bra.s .nos
  10055. .nor:
  10056.  st d5
  10057. .nos:
  10058.  bra .cantell
  10059.  
  10060. .canttell:
  10061.  st d5
  10062.  st anyclipping
  10063.  
  10064. .cantell:
  10065.  
  10066.  
  10067.  dbra d7,cornerprocessloop
  10068.  
  10069.  
  10070.  move.l (a7)+,a0
  10071.  tst.b d5
  10072.  bne.s somefloortodraw
  10073.  eor.b d4,d6
  10074.  bne dontdrawreturn
  10075.  
  10076. somefloortodraw:
  10077.  
  10078.  tst.b gourfloor
  10079.  bne goursides
  10080.  
  10081.  move.w #300,top
  10082.  move.w #-1,bottom
  10083.  move.w #0,drawit
  10084.  move.l #Rotated,a1
  10085.  move.l #OnScreen,a2
  10086.  move.w (a0)+,d7    ; no of sides
  10087. sideloop:
  10088.  move.w minz,d6
  10089.  move.w (a0)+,d1
  10090.  move.w (a0),d3
  10091.  and.w #$fff,d1
  10092.  and.w #$fff,d3
  10093.  
  10094.  move.w 6(a1,d1*8),d4    ;first z
  10095.  cmp.w d6,d4
  10096.  bgt firstinfront
  10097.  move.w 6(a1,d3*8),d5    ; sec z
  10098.  cmp.w d6,d5
  10099.  ble bothbehind
  10100. ** line must be on left and partially behind.
  10101.  sub.w d5,d4
  10102.  move.l (a1,d1*8),d0
  10103.  sub.l (a1,d3*8),d0
  10104.  asr.l #7,d0
  10105.  sub.w d5,d6
  10106.  muls d6,d0    ; new x coord
  10107.  divs d4,d0
  10108.  ext.l d0
  10109.  asl.l #7,d0
  10110.  
  10111.  add.l (a1,d3*8),d0
  10112.  move.w minz,d4
  10113.  move.w (a2,d3*2),d2
  10114.  divs d4,d0
  10115.  add.w MIDDLEX,d0
  10116.  move.l ypos,d3
  10117.  divs d5,d3
  10118.  move.w bottomline,d1 
  10119.  bra lineclipped
  10120.  
  10121. firstinfront:
  10122.  move.w 6(a1,d3*8),d5    ; sec z
  10123.  cmp.w d6,d5
  10124.  bgt bothinfront
  10125. ** line must be on right and partially behind.
  10126.  sub.w d4,d5    ; dz
  10127.  move.l (a1,d3*8),d2
  10128.  sub.l (a1,d1*8),d2    ; dx
  10129.  sub.w d4,d6
  10130.  asr.l #7,d2
  10131.  muls d6,d2    ; new x coord
  10132.  divs d5,d2
  10133.  ext.l d2
  10134.  asl.l #7,d2
  10135.  add.l (a1,d1*8),d2
  10136.  move.w minz,d5
  10137.  move.w (a2,d1*2),d0
  10138.  divs d5,d2
  10139.  add.w MIDDLEX,d2
  10140.  move.l ypos,d1
  10141.  divs d4,d1
  10142.  move.w bottomline,d3 
  10143.  bra lineclipped
  10144.  
  10145. bothinfront:
  10146.  
  10147. * Also, usefully enough, both are on-screen
  10148. * so no bottom clipping is needed.
  10149.  
  10150.  move.w (a2,d1*2),d0    ; first x
  10151.  move.w (a2,d3*2),d2    ; second x
  10152.  move.l ypos,d1
  10153.  move.l d1,d3
  10154.  divs d4,d1        ; first y
  10155.  divs d5,d3        ; second y
  10156. lineclipped:
  10157.  move.l #rightsidetab,a3
  10158.  cmp.w d1,d3
  10159.  beq lineflat
  10160.  st drawit
  10161.  bgt lineonright
  10162.  move.l #leftsidetab,a3
  10163.  exg d1,d3
  10164.  exg d0,d2
  10165.  
  10166.  lea (a3,d1*2),a3
  10167.  
  10168.  cmp.w top(pc),d1
  10169.  bge.s .nonewtop
  10170.  move.w d1,top
  10171. .nonewtop:
  10172.  cmp.w bottom(pc),d3
  10173.  ble.s .nonewbot
  10174.  move.w d3,bottom
  10175. .nonewbot:
  10176.  
  10177.  sub.w d1,d3    ; dy
  10178.  sub.w d0,d2    ; dx
  10179.  
  10180.  blt .linegoingleft
  10181.  
  10182.  ext.l d2
  10183.  divs d3,d2
  10184.  move.w d2,d6
  10185.  swap d2
  10186.  
  10187. ; moveq #0,d6
  10188. ; sub.w d3,d2
  10189. ; blt.s .noco
  10190. ;.makeco
  10191. ; addq #1,d6
  10192. ; sub.w d3,d2
  10193. ; bge.s .makeco
  10194. ;.noco
  10195. ; add.w d3,d2
  10196.  
  10197.  move.w d3,d4
  10198.  move.w d3,d5
  10199.  subq #1,d5
  10200.  move.w d6,d1
  10201.  addq #1,d1
  10202.  
  10203. .pixlopright:
  10204.  move.w d0,(a3)+
  10205.  sub.w d2,d4
  10206.  bge.s .nobigstep
  10207.  add.w d1,d0
  10208.  add.w d3,d4
  10209.  dbra d5,.pixlopright
  10210.  bra lineflat
  10211. .nobigstep
  10212.  add.w d6,d0
  10213.  dbra d5,.pixlopright
  10214.  bra lineflat
  10215.  
  10216. .linegoingleft:
  10217.  
  10218.  neg.w d2
  10219.  
  10220.  ext.l d2
  10221.  divs d3,d2
  10222.  move.w d2,d6
  10223.  swap d2
  10224.  
  10225.  
  10226. ; moveq #0,d6
  10227. ; sub.w d3,d2
  10228. ; blt.s .nocol
  10229. ;.makecol
  10230. ; addq #1,d6
  10231. ; sub.w d3,d2
  10232. ; bge.s .makecol
  10233. ;.nocol
  10234. ; add.w d3,d2
  10235.  
  10236.  
  10237.  
  10238.  move.w d3,d4
  10239.  move.w d3,d5
  10240.  subq #1,d5
  10241.  
  10242.  move.w d6,d1
  10243.  addq #1,d1
  10244.  
  10245. .pixlopleft:
  10246.  sub.w d2,d4
  10247.  bge.s .nobigstepl
  10248.  sub.w d1,d0
  10249.  add.w d3,d4
  10250.  move.w d0,(a3)+
  10251.  dbra d5,.pixlopleft
  10252.  bra lineflat
  10253.  
  10254. .nobigstepl
  10255.  sub.w d6,d0
  10256.  move.w d0,(a3)+
  10257.  dbra d5,.pixlopleft
  10258.  bra lineflat
  10259.  
  10260. lineonright:
  10261.  
  10262.  lea (a3,d1*2),a3
  10263.  
  10264.  cmp.w top(pc),d1
  10265.  bge.s .nonewtop
  10266.  move.w d1,top
  10267. .nonewtop:
  10268.  cmp.w bottom(pc),d3
  10269.  ble.s .nonewbot
  10270.  move.w d3,bottom
  10271. .nonewbot:
  10272.  
  10273.  sub.w d1,d3    ; dy
  10274.  sub.w d0,d2    ; dx
  10275.  blt .linegoingleft
  10276. ; addq #1,d0
  10277.  ext.l d2
  10278.  divs d3,d2
  10279.  move.w d2,d6
  10280.  swap d2
  10281.  
  10282. ; moveq #0,d6
  10283. ; sub.w d3,d2
  10284. ; blt.s .noco
  10285. ;.makeco
  10286. ; addq #1,d6
  10287. ; sub.w d3,d2
  10288. ; bge.s .makeco
  10289. ;.noco
  10290. ; add.w d3,d2
  10291.  
  10292.  move.w d3,d4
  10293.  move.w d3,d5
  10294.  subq #1,d5
  10295.  move.w d6,d1
  10296.  addq #1,d1
  10297.  
  10298. .pixlopright:
  10299.  sub.w d2,d4
  10300.  bge.s .nobigstep
  10301.  add.w d1,d0
  10302.  add.w d3,d4
  10303.  move.w d0,(a3)+
  10304.  dbra d5,.pixlopright
  10305.  bra lineflat
  10306.  
  10307. .nobigstep
  10308.  add.w d6,d0
  10309.  move.w d0,(a3)+
  10310.  dbra d5,.pixlopright
  10311.  bra lineflat
  10312.  
  10313. .linegoingleft:
  10314. ; addq #1,d0
  10315.  neg.w d2
  10316.  
  10317.  ext.l d2
  10318.  divs d3,d2
  10319.  move.w d2,d6
  10320.  swap d2
  10321.  
  10322.  
  10323. ; moveq #0,d6
  10324. ; sub.w d3,d2
  10325. ; blt.s .nocol
  10326. ;.makecol
  10327. ; addq #1,d6
  10328. ; sub.w d3,d2
  10329. ; bge.s .makecol
  10330. ;.nocol
  10331. ; add.w d3,d2
  10332.  
  10333.  move.w d3,d4
  10334.  move.w d3,d5
  10335.  subq #1,d5
  10336.  move.w d6,d1
  10337.  addq #1,d1
  10338.  
  10339. .pixlopleft:
  10340.  move.w d0,(a3)+
  10341.  sub.w d2,d4
  10342.  bge.s .nobigstepl
  10343.  sub.w d1,d0
  10344.  add.w d3,d4
  10345.  dbra d5,.pixlopleft
  10346.  bra lineflat
  10347.  
  10348. .nobigstepl
  10349.  sub.w d6,d0
  10350.  dbra d5,.pixlopleft
  10351.  
  10352. lineflat:
  10353.  
  10354. bothbehind:
  10355.  dbra d7,sideloop
  10356.  bra pastsides
  10357.  
  10358. fbr: dc.w 0
  10359. sbr: dc.w 0
  10360. FloorPtBrights: dc.l 0
  10361.  
  10362. goursides:
  10363.  
  10364.  move.w #300,top
  10365.  move.w #-1,bottom
  10366.  move.w #0,drawit
  10367.  move.l #Rotated,a1
  10368.  move.l #OnScreen,a2
  10369.  move.w (a0)+,d7    ; no of sides
  10370. sideloopGOUR:
  10371.  move.w minz,d6
  10372.  move.w (a0)+,d1
  10373.  move.w (a0),d3
  10374.  
  10375.  move.w d1,d4
  10376.  move.w d3,d5
  10377.  and.w #$0fff,d1
  10378.  and.w #$0fff,d3
  10379.  
  10380.  rol.w #4,d4
  10381.  rol.w #4,d5
  10382.  and.w #$f,d4
  10383.  and.w #$f,d5
  10384.  
  10385.  move.l FloorPtBrights,a4
  10386.  move.w (a4,d4.w*8),d4
  10387.  bge.s .okpos1
  10388.  neg.w d4
  10389. .okpos1:
  10390.  sub.w #300,d4
  10391.  move.w d4,fbr
  10392.  move.w (a4,d5.w*8),d4
  10393.  bge.s .okpos2
  10394.  neg.w d4
  10395. .okpos2:
  10396.  sub.w #300,d4
  10397.  move.w d4,sbr
  10398.  
  10399.  move.w 6(a1,d1*8),d4    ;first z
  10400.  cmp.w d6,d4
  10401.  bgt firstinfrontGOUR
  10402.  move.w 6(a1,d3*8),d5    ; sec z
  10403.  cmp.w d6,d5
  10404.  ble bothbehindGOUR
  10405. ** line must be on left and partially behind.
  10406.  sub.w d5,d4
  10407.  
  10408.  move.w fbr,d0
  10409.  sub.w sbr,d0
  10410.  sub.w d5,d6
  10411.  muls d6,d0
  10412.  divs d4,d0
  10413.  add.w sbr,d0
  10414.  move.w d0,fbr
  10415.  
  10416.  move.l (a1,d1*8),d0
  10417.  sub.l (a1,d3*8),d0
  10418.  asr.l #7,d0
  10419.  muls d6,d0    ; new x coord
  10420.  divs d4,d0
  10421.  ext.l d0
  10422.  asl.l #7,d0
  10423.  
  10424.  add.l (a1,d3*8),d0
  10425.  move.w minz,d4
  10426.  move.w (a2,d3*2),d2
  10427.  divs d4,d0
  10428.  add.w MIDDLEX,d0
  10429.  move.l ypos,d3
  10430.  divs d5,d3
  10431.  
  10432.  move.w bottomline,d1 
  10433.  bra lineclippedGOUR
  10434.  
  10435. firstinfrontGOUR:
  10436.  move.w 6(a1,d3*8),d5    ; sec z
  10437.  cmp.w d6,d5
  10438.  bgt bothinfrontGOUR
  10439. ** line must be on right and partially behind.
  10440.  sub.w d4,d5    ; dz
  10441.  
  10442.  move.w sbr,d2
  10443.  sub.w fbr,d2
  10444.  sub.w d4,d6
  10445.  muls d6,d2
  10446.  divs d5,d2
  10447.  add.w fbr,d2
  10448.  move.w d2,sbr
  10449.  
  10450.  move.l (a1,d3*8),d2
  10451.  sub.l (a1,d1*8),d2    ; dx
  10452.  asr.l #7,d2
  10453.  muls d6,d2    ; new x coord
  10454.  divs d5,d2
  10455.  ext.l d2
  10456.  asl.l #7,d2
  10457.  add.l (a1,d1*8),d2
  10458.  move.w minz,d5
  10459.  move.w (a2,d1*2),d0
  10460.  divs d5,d2
  10461.  add.w MIDDLEX,d2
  10462.  move.l ypos,d1
  10463.  divs d4,d1
  10464.  move.w bottomline,d3 
  10465.  bra lineclippedGOUR
  10466.  
  10467. bothinfrontGOUR:
  10468.  
  10469. * Also, usefully enough, both are on-screen
  10470. * so no bottom clipping is needed.
  10471.  
  10472.  move.w (a2,d1*2),d0    ; first x
  10473.  move.w (a2,d3*2),d2    ; second x
  10474.  move.l ypos,d1
  10475.  move.l d1,d3
  10476.  divs d4,d1        ; first y
  10477.  divs d5,d3        ; second y
  10478. lineclippedGOUR:
  10479.  move.l #rightsidetab,a3
  10480.  cmp.w d1,d3
  10481.  bne linenotflatGOUR
  10482.  
  10483. ; move.w fbr,d4
  10484. ; move.w sbr,d5
  10485. ; cmp.w d0,d2
  10486. ; bgt.s .nsw
  10487. ; exg d4,d5
  10488. ;.nsw:
  10489.  
  10490. ; move.l #leftbrighttab,a3
  10491. ; move.w d4,(a3,d3.w)
  10492. ; move.l #rightbrighttab,a3
  10493. ; move.w d5,(a3,d3.w) 
  10494.  bra lineflatGOUR
  10495.  
  10496. linenotflatGOUR
  10497.  st drawit
  10498.  bgt lineonrightGOUR
  10499.  move.l #leftsidetab,a3
  10500.  exg d1,d3
  10501.  exg d0,d2
  10502.  
  10503.  lea (a3,d1*2),a3
  10504.  lea leftbrighttab-leftsidetab(a3),a4
  10505.  
  10506.  cmp.w top(pc),d1
  10507.  bge.s .nonewtop
  10508.  move.w d1,top
  10509. .nonewtop:
  10510.  cmp.w bottom(pc),d3
  10511.  ble.s .nonewbot
  10512.  move.w d3,bottom
  10513. .nonewbot:
  10514.  
  10515.  sub.w d1,d3    ; dy
  10516.  sub.w d0,d2    ; dx
  10517.  
  10518.  blt .linegoingleft
  10519.  
  10520.  ext.l d2
  10521.  divs d3,d2
  10522.  move.w d2,d6
  10523.  swap d2
  10524.  move.w d2,a5
  10525.  
  10526. ; moveq #0,d6
  10527. ; sub.w d3,d2
  10528. ; blt.s .noco
  10529. ;.makeco
  10530. ; addq #1,d6
  10531. ; sub.w d3,d2
  10532. ; bge.s .makeco
  10533. ;.noco
  10534. ; add.w d3,d2
  10535.  
  10536.  move.w d3,d4
  10537.  move.w d3,d5
  10538.  subq #1,d5
  10539.  move.w d6,d1
  10540.  addq #1,d1
  10541.  move.w d1,a6
  10542.  
  10543.  moveq #0,d1
  10544.  move.w sbr,d1
  10545.  move.w fbr,d2
  10546.  sub.w d1,d2
  10547.  ext.l d2
  10548.  asl.w #8,d2
  10549.  asl.w #2,d2
  10550.  divs d3,d2 
  10551.  ext.l d2
  10552.  asl.l #6,d2
  10553.  swap d1
  10554.  
  10555. .pixlopright:
  10556.  move.w d0,(a3)+
  10557.  swap d1
  10558.  move.w d1,(a4)+
  10559.  swap d1
  10560.  add.l d2,d1
  10561.  
  10562.  sub.w a5,d4
  10563.  bge.s .nobigstep
  10564.  add.w a6,d0
  10565.  add.w d3,d4
  10566.  dbra d5,.pixlopright
  10567.  bra lineflatGOUR
  10568. .nobigstep
  10569.  
  10570.  add.w d6,d0
  10571.  dbra d5,.pixlopright
  10572.  bra lineflatGOUR
  10573.  
  10574. .linegoingleft:
  10575.  
  10576.  neg.w d2
  10577.  
  10578.  ext.l d2
  10579.  divs d3,d2
  10580.  move.w d2,d6
  10581.  swap d2
  10582.  
  10583.  
  10584. ; moveq #0,d6
  10585. ; sub.w d3,d2
  10586. ; blt.s .nocol
  10587. ;.makecol
  10588. ; addq #1,d6
  10589. ; sub.w d3,d2
  10590. ; bge.s .makecol
  10591. ;.nocol
  10592. ; add.w d3,d2
  10593.  
  10594.  move.w d3,d4
  10595.  move.w d3,d5
  10596.  subq #1,d5
  10597.  
  10598.  move.w d6,d1
  10599.  addq #1,d1
  10600.  move.w d1,a6
  10601.  move.w d2,a5
  10602.  
  10603.  moveq #0,d1
  10604.  move.w sbr,d1
  10605.  move.w fbr,d2
  10606.  sub.w d1,d2
  10607.  ext.l d2
  10608.  asl.w #8,d2
  10609.  asl.w #2,d2
  10610.  divs d3,d2 
  10611.  ext.l d2
  10612.  asl.l #6,d2
  10613.  swap d1
  10614.  
  10615. .pixlopleft:
  10616.  
  10617.  swap d1
  10618.  move.w d1,(a4)+
  10619.  swap d1
  10620.  add.l d2,d1
  10621.  
  10622.  sub.w a5,d4
  10623.  bge.s .nobigstepl
  10624.  sub.w a6,d0
  10625.  add.w d3,d4
  10626.  move.w d0,(a3)+
  10627.  dbra d5,.pixlopleft
  10628.  bra lineflatGOUR
  10629.  
  10630. .nobigstepl
  10631.  sub.w d6,d0
  10632.  move.w d0,(a3)+
  10633.  dbra d5,.pixlopleft
  10634.  bra lineflatGOUR
  10635.  
  10636. lineonrightGOUR:
  10637.  
  10638.  lea (a3,d1*2),a3
  10639.  
  10640.  lea rightbrighttab-rightsidetab(a3),a4
  10641.  
  10642.  cmp.w top(pc),d1
  10643.  bge.s .nonewtop
  10644.  move.w d1,top
  10645. .nonewtop:
  10646.  cmp.w bottom(pc),d3
  10647.  ble.s .nonewbot
  10648.  move.w d3,bottom
  10649. .nonewbot:
  10650.  
  10651.  sub.w d1,d3    ; dy
  10652.  sub.w d0,d2    ; dx
  10653.  blt .linegoingleft
  10654. ; addq #1,d0
  10655.  ext.l d2
  10656.  divs d3,d2
  10657.  move.w d2,d6
  10658.  swap d2
  10659.  
  10660. ; moveq #0,d6
  10661. ; sub.w d3,d2
  10662. ; blt.s .noco
  10663. ;.makeco
  10664. ; addq #1,d6
  10665. ; sub.w d3,d2
  10666. ; bge.s .makeco
  10667. ;.noco
  10668. ; add.w d3,d2
  10669.  
  10670.  move.w d3,d4
  10671.  move.w d3,d5
  10672.  subq #1,d5
  10673.  move.w d6,d1
  10674.  addq #1,d1
  10675.  
  10676.  move.w d1,a6
  10677.  move.w d2,a5
  10678.  
  10679.  moveq #0,d1
  10680.  move.w fbr,d1
  10681.  move.w sbr,d2
  10682.  sub.w d1,d2
  10683.  ext.l d2
  10684.  asl.w #8,d2
  10685.  asl.w #2,d2
  10686.  divs d3,d2 
  10687.  ext.l d2
  10688.  asl.l #6,d2
  10689.  swap d1
  10690.  
  10691. .pixlopright:
  10692.  
  10693.  swap d1
  10694.  move.w d1,(a4)+
  10695.  swap d1
  10696.  add.l d2,d1
  10697.  
  10698.  sub.w a5,d4
  10699.  bge.s .nobigstep
  10700.  add.w a6,d0
  10701.  add.w d3,d4
  10702.  move.w d0,(a3)+
  10703.  dbra d5,.pixlopright
  10704.  bra lineflatGOUR
  10705.  
  10706. .nobigstep
  10707.  add.w d6,d0
  10708.  move.w d0,(a3)+
  10709.  dbra d5,.pixlopright
  10710.  bra lineflatGOUR
  10711.  
  10712. .linegoingleft:
  10713. ; addq #1,d0
  10714.  neg.w d2
  10715.  
  10716.  ext.l d2
  10717.  divs d3,d2
  10718.  move.w d2,d6
  10719.  swap d2
  10720.  
  10721.  
  10722. ; moveq #0,d6
  10723. ; sub.w d3,d2
  10724. ; blt.s .nocol
  10725. ;.makecol
  10726. ; addq #1,d6
  10727. ; sub.w d3,d2
  10728. ; bge.s .makecol
  10729. ;.nocol
  10730. ; add.w d3,d2
  10731.  
  10732.  move.w d3,d4
  10733.  move.w d3,d5
  10734.  subq #1,d5
  10735.  move.w d6,d1
  10736.  addq #1,d1
  10737.  move.w d1,a6
  10738.  move.w d2,a5
  10739.  
  10740.  moveq #0,d1
  10741.  move.w fbr,d1
  10742.  move.w sbr,d2
  10743.  sub.w d1,d2
  10744.  ext.l d2
  10745.  asl.w #8,d2
  10746.  asl.w #2,d2
  10747.  divs d3,d2 
  10748.  ext.l d2
  10749.  asl.l #6,d2
  10750.  swap d1
  10751.  
  10752. .pixlopleft:
  10753.  
  10754.  swap d1
  10755.  move.w d1,(a4)+
  10756.  swap d1
  10757.  add.l d2,d1
  10758.  
  10759.  move.w d0,(a3)+
  10760.  sub.w a5,d4
  10761.  bge.s .nobigstepl
  10762.  sub.w a6,d0
  10763.  add.w d3,d4
  10764.  dbra d5,.pixlopleft
  10765.  bra lineflatGOUR
  10766.  
  10767. .nobigstepl
  10768.  sub.w d6,d0
  10769.  dbra d5,.pixlopleft
  10770.  
  10771. lineflatGOUR:
  10772.  
  10773. bothbehindGOUR:
  10774.  dbra d7,sideloopGOUR
  10775.  
  10776. pastsides:
  10777.  
  10778.  addq #2,a0
  10779.  
  10780.  move.w #320,linedir
  10781.  
  10782. ; move.l FASTBUFFER2,a6
  10783. ; add.l BIGMIDDLEY,a6
  10784. ; move.l a6,REFPTR
  10785.  
  10786.  move.l FASTBUFFER,a6
  10787.  add.l BIGMIDDLEY,a6
  10788.  move.w (a0)+,d6
  10789.  add.w SMALLIT,d6
  10790.  move.w d6,scaleval
  10791.  move.w (a0)+,d6
  10792.  
  10793.  ifne CHEESEY
  10794.  move.w d6,d7    ; 000000XX000000YY
  10795.  lsr.w #6,d6
  10796.  add.w d6,d7    ; 000000XX0000XXYY
  10797.  
  10798.  and.b #%111,d6    ; 000000XX00000XYY
  10799.  add.b d7,d7    ; 000000XX0000XYY0
  10800.  asl.w #4,d7    ; 00XX0000 XYY00000
  10801.  and.w #%0010000011100000,d7
  10802.  move.w d7,d6
  10803.  endc
  10804.  
  10805.  move.w d6,whichtile
  10806.  move.w (a0)+,d6
  10807.  add.w ZoneBright,d6
  10808.  move.w d6,lighttype
  10809.  move.w above(pc),d6
  10810.  beq groundfloor
  10811. * on ceiling:
  10812.  move.w #-320,linedir
  10813.  suba.w #320,a6
  10814. groundfloor:
  10815.  
  10816.  move.w xoff,d6
  10817.  move.w zoff,d7
  10818.  add.w xwobxoff,d7
  10819.  add.w xwobzoff,d6
  10820.  ext.l d6
  10821.  ext.l d7
  10822.  
  10823.  tst.b FULLSCR
  10824.  beq.s .shiftit
  10825.  
  10826.  asl.l #2,d6
  10827.  asl.l #2,d7
  10828.  divs #3,d6
  10829.  divs #3,d7
  10830.  swap d6
  10831.  swap d7
  10832.  clr.w d6
  10833.  clr.w d7
  10834.  asr.l #2,d6
  10835.  asr.l #2,d7
  10836.  bra.s .donsht
  10837.  
  10838. .shiftit
  10839.  
  10840. ; divs #3,d6
  10841. ; divs #3,d7
  10842.  swap d6
  10843.  swap d7
  10844.  clr.w d6
  10845.  clr.w d7
  10846.  asr.l #1,d6
  10847.  asr.l #1,d7
  10848. .donsht:
  10849.  move.w scaleval(pc),d3
  10850.  beq.s .samescale
  10851.  bgt.s .scaledown
  10852.  neg.w d3
  10853.  asr.l d3,d7
  10854.  asr.l d3,d6
  10855.  bra.s .samescale
  10856. .scaledown:
  10857.  asl.l d3,d6
  10858.  asl.l d3,d7
  10859. .samescale
  10860.  
  10861.  ifne CHEESEY
  10862.  asr.l #1,d6
  10863.  asr.l #1,d7
  10864.  endc
  10865.  
  10866.  move.l d6,sxoff
  10867.  move.l d7,szoff
  10868.  bra pastscale 
  10869.  
  10870.  asr.l #3,d1
  10871.  asr.l #3,d2
  10872.  asr.l #2,d1
  10873.  asr.l #2,d2
  10874.  asr.l #1,d1
  10875.  asr.l #1,d2
  10876. scaleprogfrom
  10877.  nop
  10878.  nop
  10879.  asl.l #1,d1
  10880.  asl.l #1,d2
  10881.  asl.l #2,d1
  10882.  asl.l #2,d2
  10883.  asl.l #3,d1
  10884.  asl.l #3,d2
  10885.  
  10886. top: dc.w 0
  10887. bottom: dc.w 0
  10888. ypos: dc.l 0
  10889. nfloors: dc.w 0
  10890. lighttype: dc.w 0
  10891. above: dc.w 0 
  10892. linedir: dc.w 0
  10893. distaddr: dc.w 0
  10894.  
  10895. minz: dc.l 0
  10896.  
  10897. leftsidetab:
  10898.  ds.w 512*2
  10899. rightsidetab:
  10900.  ds.w 512*2
  10901. leftbrighttab:
  10902.  ds.w 512*2
  10903. rightbrighttab:
  10904.  ds.w 512*2
  10905.  
  10906. PointBrights:
  10907.  dc.l 0
  10908. CurrentPointBrights:
  10909.  ds.l 2*256*10
  10910.  
  10911. movespd: dc.w 0
  10912. largespd: dc.l 0
  10913. disttobot: dc.w 0
  10914.  
  10915. pastscale:
  10916.  
  10917.  
  10918.  tst.b drawit(pc)
  10919.  beq dontdrawfloor
  10920.  
  10921.  tst.b DOUBLEHEIGHT
  10922.  beq pix1h
  10923.  
  10924.  move.l a0,-(a7)
  10925.  move.w linedir,d1
  10926.  add.w d1,linedir
  10927.  
  10928.  move.l #leftsidetab,a4
  10929.  move.w top(pc),d1
  10930.  tst.w above
  10931.  beq.s .clipfloor
  10932.  
  10933.  sub.w #320,a6
  10934.  
  10935.  move.w MIDDLEY,d7
  10936.  subq #1,d7
  10937.  sub.w d1,d7
  10938.  move.w d7,disttobot
  10939.  
  10940.  move.w bottom(pc),d7
  10941.  move.w MIDDLEY,d3
  10942.  move.w d3,d4
  10943.  sub.w topclip,d3
  10944.  sub.w botclip,d4
  10945.  cmp.w d3,d1
  10946.  bge predontdrawfloor
  10947.  cmp.w d4,d7
  10948.  blt predontdrawfloor
  10949.  cmp.w d4,d1
  10950.  bge.s .nocliptoproof
  10951.  move.w d4,d1
  10952. .nocliptoproof
  10953.  cmp.w d3,d7
  10954.  blt .doneclip
  10955.  move.w d3,d7
  10956.  bra .doneclip
  10957.  
  10958. .clipfloor:
  10959.  move.w BOTTOMY,d7
  10960.  sub.w MIDDLEY,d7
  10961.  subq #1,d7
  10962.  sub.w d1,d7
  10963.  move.w d7,disttobot
  10964.  
  10965.  move.w bottom(pc),d7
  10966.  move.w botclip,d4
  10967.  sub.w MIDDLEY,d4
  10968.  cmp.w d4,d1
  10969.  bge predontdrawfloor
  10970.  move.w topclip,d3
  10971.  sub.w MIDDLEY,d3
  10972.  cmp.w d3,d1
  10973.  bge.s .nocliptopfloor
  10974.  move.w d3,d1
  10975. .nocliptopfloor 
  10976.  cmp.w d3,d7
  10977.  ble predontdrawfloor
  10978.  cmp.w d4,d7
  10979.  blt.s .noclipbotfloor
  10980.  move.w d4,d7
  10981. .noclipbotfloor:
  10982.  
  10983. .doneclip:
  10984.  
  10985.  lea (a4,d1*2),a4
  10986.  addq #1,d7
  10987.  sub.w d1,d7
  10988.  
  10989. ;moveq #0,d0
  10990.  asr.w #1,d1
  10991. ; addx d0,d1
  10992.  
  10993. ; move.l #dists,a2
  10994.  move.w distaddr,d0
  10995.  muls #64,d0
  10996.  move.l d0,a2
  10997. ; muls #25,d0
  10998. ; adda.w d0,a2
  10999. ; lea (a2,d1*2),a2
  11000.  asr.w #1,d7
  11001.  ble predontdrawfloor 
  11002.  move.w d1,d0
  11003.  bne.s .notzero
  11004.  moveq #1,d0
  11005. .notzero
  11006.  add.w d0,d0
  11007.  muls linedir,d1
  11008.  add.l d1,a6
  11009. ; sub.l d1,REFPTR
  11010.  move.l TexturePal,a1
  11011.  add.l #256*32,a1
  11012.  move.l LineToUse,a5
  11013.  
  11014.  move.w #4,tonextline
  11015.  
  11016.  bra pix2h
  11017.  
  11018. pix1h:
  11019.  
  11020.  move.l a0,-(a7)
  11021.  
  11022.  move.l #leftsidetab,a4
  11023.  move.w top(pc),d1
  11024.   
  11025.  tst.w above
  11026.  beq.s clipfloor
  11027.  
  11028.  move.w MIDDLEY,d7
  11029.  subq #1,d7
  11030.  sub.w d1,d7
  11031.  move.w d7,disttobot
  11032.  
  11033.  move.w bottom(pc),d7
  11034.  move.w MIDDLEY,d3
  11035.  move.w d3,d4
  11036.  sub.w topclip,d3
  11037.  sub.w botclip,d4
  11038.  cmp.w d3,d1
  11039.  bge predontdrawfloor
  11040.  cmp.w d4,d7
  11041.  blt predontdrawfloor
  11042.  cmp.w d4,d1
  11043.  bge.s .nocliptoproof
  11044.  move.w d4,d1
  11045. .nocliptoproof
  11046.  cmp.w d3,d7
  11047.  blt doneclip
  11048.  move.w d3,d7
  11049.  bra doneclip
  11050.  
  11051. clipfloor:
  11052.  move.w BOTTOMY,d7
  11053.  sub.w MIDDLEY,d7
  11054.  subq #1,d7
  11055.  sub.w d1,d7
  11056.  move.w d7,disttobot
  11057.  
  11058.  move.w bottom(pc),d7
  11059.  move.w botclip,d4
  11060.  sub.w MIDDLEY,d4
  11061.  cmp.w d4,d1
  11062.  bge predontdrawfloor
  11063.  move.w topclip,d3
  11064.  sub.w MIDDLEY,d3
  11065.  cmp.w d3,d1
  11066.  bge.s .nocliptopfloor
  11067.  move.w d3,d1
  11068. .nocliptopfloor 
  11069.  cmp.w d3,d7
  11070.  ble predontdrawfloor
  11071.  cmp.w d4,d7
  11072.  blt.s .noclipbotfloor
  11073.  move.w d4,d7
  11074. .noclipbotfloor:
  11075.  
  11076. doneclip:
  11077.  
  11078.  lea (a4,d1*2),a4
  11079. ; move.l #dists,a2
  11080.  move.w distaddr,d0
  11081.  muls #64,d0
  11082.  move.l d0,a2
  11083. ; muls #25,d0
  11084. ; adda.w d0,a2
  11085. ; lea (a2,d1*2),a2
  11086.  sub.w d1,d7
  11087.  ble predontdrawfloor 
  11088.  move.w d1,d0
  11089.  bne.s .notzero
  11090.  moveq #1,d0
  11091. .notzero
  11092.  muls linedir,d1
  11093.  add.l d1,a6
  11094. ; sub.l d1,REFPTR
  11095.  move.l TexturePal,a1
  11096.  add.l #256*32,a1
  11097.  move.l LineToUse,a5
  11098.  
  11099.  move.w #2,tonextline
  11100.  
  11101. pix2h:
  11102.  
  11103.  tst.b gourfloor
  11104.  bne dogourfloor
  11105.  
  11106.  tst.b anyclipping
  11107.  beq dofloornoclip
  11108.  
  11109. dofloor:
  11110. ; move.w (a2)+,d0
  11111.  move.w leftclip,d3
  11112.  move.w rightclip,d4
  11113.  move.w rightsidetab-leftsidetab(a4),d2
  11114.  
  11115.  addq #1,d2
  11116.  cmp.w d3,d2
  11117.  ble.s nodrawline
  11118.  cmp.w d4,d2
  11119.  ble.s noclipright
  11120.  move.w d4,d2
  11121. noclipright:
  11122.  move.w (a4),d1
  11123.  cmp.w d4,d1
  11124.  bge.s nodrawline
  11125.  cmp.w d3,d1
  11126.  bge.s noclipleft
  11127.  move.w d3,d1
  11128. noclipleft:
  11129.  cmp.w d1,d2
  11130.  ble.s nodrawline
  11131.  
  11132.  move.w d1,leftedge
  11133.  move.w d2,rightedge
  11134.  
  11135. ; moveq #0,d1
  11136. ; moveq #0,d3
  11137. ; move.w leftbrighttab-leftsidetab(a4),d1
  11138. ; bge.s .okbl
  11139. ; moveq #0,d1
  11140. ;.okbl:
  11141.  
  11142. ; move.w rightbrighttab-leftsidetab(a4),d3
  11143. ; bge.s .okbr
  11144. ; moveq #0,d3
  11145. ;.okbr:
  11146.  
  11147. ; sub.w d1,d3
  11148. ; asl.w #8,d1
  11149. ; move.l d1,leftbright
  11150. ; swap d3
  11151. ; asr.l #5,d3
  11152. ; divs d5,d3
  11153. ; move.w d3,d5
  11154. ; muls.w d6,d5
  11155. ; asr.l #3,d5
  11156. ; clr.b d5
  11157. ; add.w d5,leftbright+2
  11158.  
  11159. ; ext.l d3
  11160. ; asl.l #5,d3
  11161. ; swap d3
  11162. ; asl.w #8,d3
  11163. ; move.l d3,brightspd
  11164.  
  11165.  move.l a6,a3
  11166.  movem.l d0/d7/a2/a4/a5/a6,-(a7)
  11167.  move.l a2,d7
  11168.  asl.l #2,d7
  11169.  ext.l d0
  11170.  divs.l d0,d7
  11171.  move.l d7,d0
  11172.  jsr (a5)
  11173.  movem.l (a7)+,d0/d7/a2/a4/a5/a6
  11174. nodrawline
  11175.  sub.w #1,disttobot
  11176.  move.w linedir(pc),d3
  11177.  adda.w d3,a6
  11178. ; ext.l d3
  11179. ; sub.l d3,REFPTR
  11180.  move.w tonextline,d3
  11181.  add.w d3,a4
  11182.  asr.w #1,d3
  11183.  add.w d3,d0
  11184.  subq #1,d7
  11185.  bgt dofloor
  11186.  
  11187. predontdrawfloor
  11188.  move.l (a7)+,a0
  11189.  
  11190. dontdrawfloor:
  11191.  
  11192.  rts
  11193.  
  11194. tonextline: dc.w 0
  11195. anyclipping: dc.w 0
  11196.  
  11197. dofloornoclip:
  11198. ; move.w (a2)+,d0
  11199.  move.w rightsidetab-leftsidetab(a4),d2
  11200.  addq #1,d2
  11201.  move.w (a4),d1
  11202.  move.w d1,leftedge
  11203.  move.w d2,rightedge
  11204.  
  11205. ; sub.w d1,d2
  11206.  
  11207. ; moveq #0,d1
  11208. ; moveq #0,d3
  11209. ; move.w leftbrighttab-leftsidetab(a4),d1
  11210. ; bge.s .okbl
  11211. ; moveq #0,d1
  11212. ;.okbl:
  11213.  
  11214. ; move.w rightbrighttab-leftsidetab(a4),d3
  11215. ; bge.s .okbr
  11216. ; moveq #0,d3
  11217. ;.okbr:
  11218.  
  11219. ; sub.w d1,d3
  11220. ; asl.w #8,d1
  11221. ; move.l d1,leftbright
  11222. ; swap d3
  11223. ; asr.l #5,d3
  11224. ; divs d2,d3
  11225. ; ext.l d3
  11226. ; asl.l #5,d3
  11227. ; swap d3
  11228. ; asl.w #8,d3
  11229. ; move.l d3,brightspd
  11230.  
  11231.  move.l a6,a3
  11232.  movem.l d0/d7/a2/a4/a5/a6,-(a7)
  11233.  move.l a2,d7
  11234.  asl.l #2,d7
  11235.  ext.l d0
  11236.  divs.l d0,d7
  11237.  move.l d7,d0
  11238.  jsr (a5)
  11239.  movem.l (a7)+,d0/d7/a2/a4/a5/a6
  11240.  sub.w #1,disttobot
  11241.  move.w linedir(pc),d3
  11242.  adda.w d3,a6
  11243. ; ext.l d3
  11244. ; sub.l d3,REFPTR
  11245.  move.w tonextline,d3
  11246.  add.w d3,a4
  11247.  asr.w #1,d3
  11248.  add.w d3,d0
  11249.  subq #1,d7
  11250.  bgt dofloornoclip
  11251.  
  11252.  bra predontdrawfloor
  11253.  
  11254. dogourfloor:
  11255.  tst.b anyclipping
  11256.  beq dofloornoclipGOUR
  11257.  
  11258. dofloorGOUR:
  11259. ; move.w (a2)+,d0
  11260.  move.w leftclip,d3
  11261.  move.w rightclip,d4
  11262.  move.w rightsidetab-leftsidetab(a4),d2
  11263.  
  11264.  move.w d2,d5
  11265.  sub.w (a4),d5
  11266.  addq #1,d5
  11267.  moveq #0,d6
  11268.  
  11269.  addq #1,d2
  11270.  cmp.w d3,d2
  11271.  ble nodrawlineGOUR
  11272.  cmp.w d4,d2
  11273.  ble.s nocliprightGOUR
  11274.  move.w d4,d2
  11275. nocliprightGOUR:
  11276.  move.w (a4),d1
  11277.  cmp.w d4,d1
  11278.  bge nodrawlineGOUR
  11279.  cmp.w d3,d1
  11280.  bge.s noclipleftGOUR
  11281.  move.w d3,d6
  11282.  subq #1,d6
  11283.  sub.w d1,d6
  11284.  move.w d3,d1
  11285. noclipleftGOUR:
  11286.  cmp.w d1,d2
  11287.  ble nodrawlineGOUR
  11288.  
  11289.  move.w d1,leftedge
  11290.  move.w d2,rightedge
  11291.  
  11292.  move.l a2,d2
  11293.  asl.l #2,d2
  11294.  ext.l d0
  11295.  divs.l d0,d2
  11296.  move.l d2,dst
  11297.  asr.l #7,d2
  11298.  asr.l #2,d2
  11299. ; addq #5,d2
  11300. ; add.w lighttype,d2
  11301.  
  11302.  moveq #0,d1
  11303.  moveq #0,d3
  11304.  move.w leftbrighttab-leftsidetab(a4),d1
  11305.  add.w d2,d1
  11306.  bge.s .okbl
  11307.  moveq #0,d1
  11308. .okbl:
  11309. ; asr.w #1,d1
  11310.  cmp.w #30,d1
  11311.  ble.s .okdl
  11312.  move.w #30,d1
  11313. .okdl:
  11314.  
  11315.  move.w rightbrighttab-leftsidetab(a4),d3
  11316.  add.w d2,d3
  11317.  bge.s .okbr
  11318.  moveq #0,d3
  11319. .okbr:
  11320. ; asr.w #1,d3
  11321.  cmp.w #30,d3
  11322.  ble.s .okdr
  11323.  move.w #30,d3
  11324. .okdr:
  11325.  
  11326.  sub.w d1,d3
  11327.  asl.w #8,d1
  11328.  move.w d1,leftbright
  11329.  swap d3
  11330.  tst.l d3
  11331.  bgt.s .OKITSPOSALREADY 
  11332.  neg.l d3
  11333.  asr.l #6,d3
  11334.  divs d5,d3
  11335.  neg.w d3
  11336.  bra.s .OKNOWITSNEG
  11337.  
  11338. .OKITSPOSALREADY
  11339.  asr.l #6,d3
  11340.  divs d5,d3
  11341. .OKNOWITSNEG
  11342.  muls d3,d6
  11343.  add.w #256*4,d6
  11344.  asr.w #2,d6
  11345.  clr.b d6
  11346.  add.w leftbright,d6
  11347.  bge.s .oklbnn
  11348.  moveq #0,d6
  11349. .oklbnn:
  11350.  move.w d6,leftbright
  11351.  
  11352.  ext.l d3
  11353.  asr.l #2,d3
  11354. ; swap d3
  11355. ; asl.w #8,d3
  11356.  move.w d3,brightspd
  11357.  
  11358.  move.l a6,a3
  11359.  movem.l d0/d7/a2/a4/a5/a6,-(a7)
  11360.  move.l dst,d0
  11361.  move.l TexturePal,a1
  11362.  add.l #256*32,a1
  11363.  move.l floortile,a0
  11364.  adda.w whichtile,a0
  11365.  jsr pastfloorbright
  11366.  movem.l (a7)+,d0/d7/a2/a4/a5/a6
  11367. nodrawlineGOUR
  11368.  
  11369.  sub.w #1,disttobot
  11370.  
  11371.  move.w linedir(pc),d3
  11372.  adda.w d3,a6
  11373. ; ext.l d3
  11374. ; sub.l d3,REFPTR
  11375.  move.w tonextline,d3
  11376.  add.w d3,a4
  11377.  asr.w #1,d3
  11378.  add.w d3,d0
  11379.  subq #1,d7
  11380.  bgt dofloorGOUR
  11381.  
  11382. predontdrawfloorGOUR
  11383.  move.l (a7)+,a0
  11384.  
  11385. dontdrawfloorGOUR:
  11386.  
  11387.  rts
  11388.  
  11389. REFPTR: dc.l 0
  11390.  
  11391. dofloornoclipGOUR:
  11392. ; move.w (a2)+,d0
  11393.  move.w rightsidetab-leftsidetab(a4),d2
  11394.  addq #1,d2
  11395.  move.w (a4),d1
  11396.  move.w d1,leftedge
  11397.  move.w d2,rightedge
  11398.  
  11399.  sub.w d1,d2
  11400.  
  11401.  move.l a2,d6
  11402.  asl.l #2,d6
  11403.  ext.l d0
  11404.  divs.l d0,d6
  11405.  move.l d6,d5
  11406.  asr.l #7,d5
  11407.  asr.l #2,d5
  11408. ; addq #5,d5
  11409. ; add.w lighttype,d5
  11410.  
  11411.  moveq #0,d1
  11412.  moveq #0,d3
  11413.  move.w leftbrighttab-leftsidetab(a4),d1
  11414.  add.w d5,d1
  11415.  bge.s .okbl
  11416.  moveq #0,d1
  11417. .okbl:
  11418. ; asr.w #1,d1
  11419.  cmp.w #30,d1
  11420.  ble.s .okdl
  11421.  move.w #30,d1
  11422. .okdl:
  11423.  
  11424.  move.w rightbrighttab-leftsidetab(a4),d3
  11425.  add.w d5,d3
  11426.  bge.s .okbr
  11427.  moveq #0,d3
  11428. .okbr:
  11429. ; asr.w #1,d3
  11430.  cmp.w #30,d3
  11431.  ble.s .okdr
  11432.  move.w #30,d3
  11433. .okdr:
  11434.  
  11435. ; sub.w d1,d3
  11436. ; asl.w #8,d1
  11437. ; move.l d1,leftbright
  11438. ; swap d3
  11439. ; asr.l #5,d3
  11440. ; divs d2,d3
  11441. ; ext.l d3
  11442. ; asl.l #5,d3
  11443. ; swap d3
  11444. ; asl.w #8,d3
  11445. ; move.l d3,brightspd
  11446.  
  11447.  sub.w d1,d3
  11448.  asl.w #8,d1
  11449.  move.w d1,leftbright
  11450.  swap d3
  11451.  ext.l d2
  11452.  divs.l d2,d3
  11453.  asr.l #8,d3
  11454.  move.w d3,brightspd
  11455.  
  11456.  move.l a6,a3
  11457.  movem.l d0/d7/a2/a4/a5/a6,-(a7)
  11458.  move.l d6,d0
  11459.  move.l d0,dst
  11460.  move.l TexturePal,a1
  11461.  add.l #256*32,a1
  11462.  move.l floortile,a0
  11463.  adda.w whichtile,a0
  11464.  jsr pastfloorbright
  11465.  movem.l (a7)+,d0/d7/a2/a4/a5/a6
  11466.  sub.w #1,disttobot
  11467.  
  11468.  move.w linedir(pc),d3
  11469.  adda.w d3,a6
  11470. ; ext.l d3
  11471. ; sub.l d3,REFPTR
  11472.  
  11473.  move.w tonextline,d3
  11474.  add.w d3,a4
  11475.  asr.w #1,d3
  11476.  add.w d3,d0
  11477.  subq #1,d7
  11478.  bgt dofloornoclipGOUR
  11479.  
  11480.  bra predontdrawfloorGOUR
  11481.  
  11482.  
  11483.  
  11484. dists:
  11485. ; incbin "floordists"
  11486. drawit: dc.w 0
  11487.  
  11488. LineToUse: dc.l 0
  11489.  
  11490. ***************************
  11491. * Right then, time for the floor
  11492. * routine...
  11493. * For test purposes, give it
  11494. * a3 = point to screen
  11495. * d0= z distance away
  11496. * and sinval+cosval must be set up.
  11497. ***************************
  11498.  
  11499. BLACKFLOOR:
  11500.  moveq #0,d0
  11501.  bra.s DOBLACK
  11502.  
  11503. SimpleFloorLine:
  11504.  
  11505.  CACHE_OFF d2
  11506.  
  11507.  move.l #doacrossline,a1
  11508.  move.w leftedge(pc),d1
  11509.  move.w rightedge(pc),d3
  11510.  sub.w d1,d3
  11511.  lea (a1,d1.w*4),a1
  11512.  move.w (a1,d3.w*4),d4
  11513.  move.w #$4e75,(a1,d3.w*4)
  11514.  
  11515.  tst.b CLRNOFLOOR
  11516.  bne.s BLACKFLOOR
  11517.  
  11518.  move.l #PLAINSCALE,a2
  11519.  
  11520.  move.w d0,d2
  11521.  move.w lighttype,d1
  11522.  asr.w #8,d2
  11523.  add.w #5,d1
  11524.  add.w d2,d1
  11525.  bge.s .fixedbright
  11526.  moveq #0,d1
  11527. .fixedbright:
  11528.  cmp.w #28,d1
  11529.  ble.s .smallbright
  11530.  move.w #28,d1
  11531. .smallbright:
  11532.  lea (a2,d1.w*2),a2
  11533.  
  11534.  move.w whichtile,d0
  11535.  move.w d0,d1
  11536.  and.w #$3,d1
  11537.  and.w #$300,d0
  11538.  lsl.b #6,d1
  11539.  move.b d1,d0
  11540.  move.w d0,tstwhich
  11541.  move.w (a2,d0.w),d0
  11542.  
  11543. DOBLACK:
  11544.  jsr (a1)
  11545.  move.w d4,(a1,d3.w*4)
  11546.  
  11547.  CACHE_ON d2
  11548.  
  11549.  rts
  11550.  
  11551. tstwhich: dc.w 0
  11552. whichtile: dc.w 0
  11553.   
  11554. PLAINSCALE: 
  11555. ;incbin "ab3:includes/plainscale"
  11556.   
  11557. storeit: dc.l 0
  11558.  
  11559. doacrossline:
  11560. val SET 0
  11561.  REPT 32
  11562.  move.w d0,val(a3)
  11563. val SET val+4
  11564.  ENDR
  11565. val SET val+4
  11566.  REPT 32
  11567.  move.w d0,val(a3)
  11568. val SET val+4
  11569.  ENDR
  11570. val SET val+4
  11571.  REPT 32
  11572.  move.w d0,val(a3)
  11573. val SET val+4
  11574.  ENDR
  11575.  rts
  11576.  
  11577.  
  11578. leftedge: dc.w 0
  11579. rightedge: dc.w 0
  11580.  
  11581. rndpt: dc.l rndtab
  11582.  
  11583.  
  11584. dst: dc.l 0
  11585.  
  11586. FloorLine:
  11587.  
  11588.  move.l floortile,a0
  11589.  adda.w whichtile,a0
  11590.  move.w lighttype,d1
  11591.  move.l d0,dst    ; *4
  11592.  move.l d0,d2    ; *4
  11593. *********************
  11594. * Old version
  11595.  asr.l #2,d2
  11596.  asr.l #8,d2
  11597.  add.w #5,d1
  11598. *********************
  11599. ; asr.w #3,d2
  11600. ; sub.w #4,d2
  11601. ; cmp.w #6,d2
  11602. ; blt.s flbrbr
  11603. ; move.w #6,d2
  11604. ;flbrbr:
  11605. *********************
  11606.  add.w d2,d1
  11607.  bge.s .fixedbright
  11608.  moveq #0,d1
  11609. .fixedbright:
  11610.  cmp.w #28,d1
  11611.  ble.s .smallbright
  11612.  move.w #28,d1
  11613. .smallbright:
  11614.  move.l TexturePal,a1
  11615.  add.l #256*32,a1
  11616.  add.l floorbright(pc,d1.w*4),a1
  11617.  bra pastfloorbright
  11618.  
  11619. ConstCol: dc.w 0
  11620.  
  11621. BumpLine:
  11622.  
  11623.  tst.b smoothbumps
  11624.  beq.s Chunky
  11625.  
  11626.  move.l #SmoothTile,a0
  11627.  lea Smoothscalecols,a1
  11628.  bra pastast
  11629.  
  11630. Chunky:
  11631.  
  11632.  moveq #0,d2
  11633.  move.l #Bumptile,a0
  11634.  move.w whichtile,d2
  11635.  adda.w d2,a0
  11636.  ror.l #2,d2
  11637.  lsr.w #6,d2
  11638.  rol.l #2,d2
  11639.  and.w #15,d2
  11640.  move.l #ConstCols,a1
  11641.  move.w (a1,d2.w*2),ConstCol
  11642.  lea Bumpscalecols,a1
  11643.  
  11644. pastast:
  11645.  move.w lighttype,d1
  11646.  
  11647.  move.l d0,dst
  11648.  
  11649.  move.l d0,d2
  11650. *********************
  11651. * Old version
  11652.  asr.l #2,d2
  11653.  asr.l #8,d2
  11654.  add.w #5,d1
  11655. *********************
  11656. ; asr.w #3,d2
  11657. ; sub.w #4,d2
  11658. ; cmp.w #6,d2
  11659. ; blt.s flbrbr
  11660. ; move.w #6,d2
  11661. ;flbrbr:
  11662. *********************
  11663.  add.w d2,d1
  11664.  bge.s .fixedbright
  11665.  moveq #0,d1
  11666. .fixedbright:
  11667.  cmp.w #31,d1
  11668.  ble.s .smallbright
  11669.  move.w #31,d1
  11670. .smallbright:
  11671.  add.l floorbright(pc,d1.w*4),a1
  11672.  bra pastfloorbright
  11673.  
  11674.  
  11675. floorbright:
  11676.  dc.l 512*0
  11677.  dc.l 512*1
  11678.  dc.l 512*2
  11679.  dc.l 512*3
  11680.  dc.l 512*4
  11681.  
  11682.  dc.l 512*5
  11683.  dc.l 512*6
  11684.  dc.l 512*7
  11685.  dc.l 512*8
  11686.  dc.l 512*9
  11687.  
  11688.  dc.l 512*10
  11689.  dc.l 512*11
  11690.  dc.l 512*12
  11691.  dc.l 512*13
  11692.  dc.l 512*14
  11693.  
  11694.  dc.l 512*15
  11695.  dc.l 512*16
  11696.  dc.l 512*17
  11697.  dc.l 512*18
  11698.  dc.l 512*19
  11699.  
  11700.  dc.l 512*20
  11701.  dc.l 512*21
  11702.  dc.l 512*22
  11703.  dc.l 512*23
  11704.  dc.l 512*24
  11705.  
  11706.  dc.l 512*25
  11707.  dc.l 512*26
  11708.  dc.l 512*27
  11709.  dc.l 512*28
  11710.  dc.l 512*29
  11711.  
  11712.  dc.l 512*30
  11713.  dc.l 512*31
  11714.  
  11715. widthleft: dc.w 0
  11716. scaleval: dc.w 0
  11717. sxoff: dc.l 0
  11718. szoff: dc.l 0
  11719. xoff34: dc.w 0
  11720. zoff34: dc.w 0
  11721. scosval: dc.w 0
  11722. ssinval: dc.w 0
  11723.  
  11724.  
  11725. floorsetbright:
  11726.  move.l #walltiles,a0
  11727.  
  11728. pastfloorbright:
  11729.  
  11730.  move.l d0,d1
  11731.  muls cosval,d1    ; change in x across whole width
  11732.  move.l d0,d2
  11733.  muls sinval,d2    ; change in z across whole width
  11734.  neg.l d2
  11735.  ifne CHEESEY
  11736.  asr.l #3,d2
  11737.  asr.l #3,d1
  11738.  endc
  11739.  ifeq CHEESEY
  11740.  asr.l #2,d2
  11741.  asr.l #2,d1
  11742.  endc
  11743. scaleprog:
  11744.  move.w scaleval(pc),d3
  11745.  beq.s .samescale
  11746.  bgt.s .scaledown
  11747.  neg.w d3
  11748.  asr.l d3,d1
  11749.  asr.l d3,d2
  11750.  bra.s .samescale
  11751. .scaledown:
  11752.  asl.l d3,d1
  11753.  asl.l d3,d2
  11754. .samescale
  11755.  
  11756.  
  11757.  move.l d1,d3 ;    z cos
  11758.  move.l d3,d6
  11759.  move.l d3,d5
  11760.  asr.l #1,d6
  11761.  add.l d6,d3
  11762.  asr.l #1,d3
  11763.  
  11764.  move.l d2,d4    ; z sin
  11765.  move.l d4,d6
  11766.  asr.l #1,d6
  11767.  add.l d4,d6
  11768.  add.l d3,d4
  11769.  neg.l d4    ; start x
  11770.  
  11771.  asr.l #1,d6    ; zsin/2
  11772.  sub.l d6,d5    ; start z
  11773.  
  11774.  add.l sxoff,d4
  11775.  add.l szoff,d5
  11776.  
  11777.  tst.b FULLSCR
  11778.  beq.s .nob
  11779.  
  11780.  moveq #0,d6
  11781.  move.w leftedge(pc),d6
  11782.  beq.s .nomultleftB
  11783.  
  11784.  add.l d6,d6
  11785.  divs #3,d6
  11786.  ext.l d6
  11787.  
  11788.  move.l d1,a4
  11789.  move.l d2,a5
  11790.  
  11791.  muls.l d6,d1
  11792.  asr.l #7,d1
  11793.  add.l d1,d4
  11794.  
  11795.  muls.l d6,d2
  11796.  asr.l #7,d2
  11797.  add.l d2,d5
  11798.  move.l a4,d1
  11799.  move.l a5,d2
  11800.  
  11801.  move.w leftedge(pc),d6
  11802.  
  11803. .nomultleftB:
  11804.  
  11805.  move.w d4,startsmoothx
  11806.  move.w d5,startsmoothz
  11807.  
  11808.  asr.l #8,d4
  11809.  asl.l #8,d5
  11810. ; add.w szoff,d5
  11811. ; add.w sxoff,d4
  11812. ; and.w #63,d4
  11813. ; and.w #63*256,d5
  11814.  
  11815.  move.w d4,d5
  11816.  
  11817.  asr.l #6,d1
  11818.  asr.l #6,d2
  11819.  divs.l #3,d1
  11820.  divs.l #3,d2
  11821.  
  11822.  bra.s doneallmult
  11823.  
  11824. .nob 
  11825.  
  11826.  moveq #0,d6
  11827.  move.w leftedge(pc),d6
  11828.  beq.s nomultleft
  11829.  
  11830.  move.l d1,a4
  11831.  move.l d2,a5
  11832.  
  11833.  muls.l d6,d1
  11834.  asr.l #7,d1
  11835.  add.l d1,d4
  11836.  
  11837.  muls.l d6,d2
  11838.  asr.l #7,d2
  11839.  add.l d2,d5
  11840.  move.l a4,d1
  11841.  move.l a5,d2
  11842.  
  11843.  move.w leftedge(pc),d6
  11844.  
  11845. nomultleft:
  11846.  
  11847.  move.w d4,startsmoothx
  11848.  move.w d5,startsmoothz
  11849.  
  11850.  asr.l #8,d4
  11851.  asl.l #8,d5
  11852.  
  11853.  
  11854. ; add.w szoff,d5
  11855. ; add.w sxoff,d4
  11856. ; and.w #63,d4
  11857. ; and.w #63*256,d5
  11858.  
  11859.  move.w d4,d5
  11860.  
  11861.  asr.l #7,d1
  11862.  asr.l #7,d2
  11863. ; divs.l #3,d1
  11864. ; divs.l #3,d2
  11865.  
  11866. doneallmult:
  11867.  
  11868.  move.w d1,a4
  11869.  move.w d2,a5
  11870.  asl.l #8,d2
  11871. ; and.w #%0011111100000000,d2
  11872.  asr.l #8,d1
  11873.  move.w d1,d2
  11874.  ifeq CHEESEY
  11875.  move.l #$3fff3fff,d1
  11876.  endc
  11877.  ifne CHEESEY
  11878.  move.l #$1fff1fff,d1
  11879.  endc
  11880.  and.l d1,d5
  11881. ; swap d5
  11882. ; move.w startsmoothz,d5
  11883. ; swap d5
  11884. ; swap d2
  11885. ; move.w a5,d2
  11886. ; swap d2
  11887.  
  11888. ***********************************
  11889.  
  11890.  
  11891.  tst.b DOUBLEWIDTH
  11892.  beq.s .nodoub
  11893.  
  11894.  and.b #$fe,d6
  11895.  
  11896.  move.w d6,a2
  11897.  moveq #0,d0 
  11898.  move.w rightedge(pc),d3 
  11899.  lea (a3,a2.w),a3 
  11900.  move.w d3,d7
  11901.  sub.w a2,d7
  11902.  asr.w #1,d7
  11903.  move.w startsmoothx,d3
  11904.  
  11905.  tst.b usewater
  11906.  bne texturedwaterDOUB
  11907. ; tst.b gourfloor
  11908.  bra gouraudfloorDOUB
  11909.  
  11910. .nodoub:
  11911.  
  11912.  move.w d6,a2
  11913.  moveq #0,d0 
  11914.  move.w rightedge(pc),d3 
  11915.  lea (a3,a2.w),a3 
  11916.  move.w d3,d7
  11917.  sub.w a2,d7
  11918.  
  11919. intofirststrip:
  11920. allintofirst:
  11921.  
  11922.  move.w startsmoothx,d3
  11923.  
  11924. tstwat:
  11925.  
  11926.  tst.b usewater
  11927.  bne texturedwater
  11928. ; tst.b gourfloor
  11929.  bra gouraudfloor
  11930.  
  11931.  
  11932.  
  11933. ******************************
  11934. * BumpMap the floor/ceiling! *
  11935.  tst.b usebumps
  11936.  bne.s BumpMap
  11937. ******************************
  11938.  
  11939. ordinary:
  11940.  moveq #0,d0
  11941.  
  11942.  dbra d7,acrossscrn
  11943.  rts
  11944.  
  11945. usebumps: dc.w $0
  11946. smoothbumps: dc.w $0
  11947. gourfloor: dc.w 0
  11948.  
  11949.  include "ab3:source_4000/bumpmap.s"
  11950.  
  11951.  CNOP 0,4
  11952. backbefore:
  11953.  and.w d1,d5
  11954.  move.b (a0,d5.w*4),d0
  11955.  add.w a4,d3
  11956.  addx.l d6,d5
  11957.  move.w (a1,d0.w*2),(a3)
  11958.  addq #4,a3
  11959.  dbcs d7,acrossscrn
  11960.  dbcc d7,backbefore
  11961.  bra.s past1
  11962.  
  11963. acrossscrn:
  11964.  and.w d1,d5
  11965.  move.b (a0,d5.w*4),d0
  11966.  add.w a4,d3
  11967.  addx.l d2,d5
  11968.  move.w (a1,d0.w*2),(a3)
  11969.  addq #4,a3
  11970.  dbcs d7,acrossscrn
  11971.  dbcc d7,backbefore
  11972. past1:
  11973.  bcc.s gotoacross
  11974.  
  11975.  move.w d4,d7
  11976.  bne.s .notdoneyet
  11977.  rts
  11978. .notdoneyet:
  11979.  
  11980.  cmp.w #32,d7
  11981.  ble.s .notoowide
  11982.  move.w #32,d7
  11983. .notoowide
  11984.  sub.w d7,d4  
  11985.  addq #4,a3
  11986.  
  11987.  dbra d7,backbefore
  11988.  rts
  11989.  
  11990.  
  11991. gotoacross:
  11992.  
  11993.  move.w d4,d7
  11994.  bne.s .notdoneyet
  11995.  rts
  11996. .notdoneyet:
  11997.  
  11998.  cmp.w #32,d7
  11999.  ble.s .notoowide
  12000.  move.w #32,d7
  12001. .notoowide
  12002.  sub.w d7,d4  
  12003.  addq #4,a3
  12004.  
  12005.  dbra d7,acrossscrn
  12006.  rts
  12007.  
  12008. leftbright: dc.l 0
  12009. brightspd: dc.l 0
  12010.  
  12011. gouraudfloor:
  12012.  
  12013.  move.w leftbright,d0
  12014.  move.l d1,d4
  12015.  move.w brightspd,d1
  12016.  
  12017.  move.w d7,d3
  12018.  asr.w #1,d7
  12019.  btst #0,d3
  12020.  beq.s .nosingle1
  12021.  move.w d5,d3
  12022.  move.l d5,d6
  12023.  lsr.w #8,d3
  12024.  swap d6
  12025.  move.b d3,d6
  12026.  move.w d0,d3
  12027.  ifeq CHEESEY
  12028.  move.b (a0,d6.w*4),d3
  12029.  endc
  12030.  ifne CHEESEY
  12031.  move.b (a0,d6.w),d3
  12032.  endc
  12033.  
  12034.  add.w d1,d0
  12035.  add.l d2,d5
  12036.  and.l d4,d5
  12037.  move.b (a1,d3.w),(a3)+
  12038. .nosingle1
  12039.  
  12040.  move.w d7,d3
  12041.  asr.w #1,d7
  12042.  btst #0,d3
  12043.  beq.s .nosingle2
  12044.  move.w d5,d3
  12045.  move.l d5,d6
  12046.  lsr.w #8,d3
  12047.  swap d6
  12048.  move.b d3,d6
  12049.  move.w d0,d3
  12050.  ifeq CHEESEY
  12051.  move.b (a0,d6.w*4),d3
  12052.  endc
  12053.  ifne CHEESEY
  12054.  move.b (a0,d6.w),d3
  12055.  endc
  12056.  add.w d1,d0
  12057.  add.l d2,d5
  12058.  and.l d4,d5
  12059.  move.l d5,d6
  12060.  swap d6
  12061.  move.b (a1,d3.w),(a3)+
  12062.  move.w d5,d3
  12063.  lsr.w #8,d3
  12064.  move.b d3,d6
  12065.  move.w d0,d3
  12066.  ifeq CHEESEY
  12067.  move.b (a0,d6.w*4),d3
  12068.  endc
  12069.  ifne CHEESEY
  12070.  move.b (a0,d6.w),d3
  12071.  endc
  12072.  add.w d1,d0
  12073.  add.l d2,d5
  12074.  and.l d4,d5
  12075.  move.b (a1,d3.w),(a3)+
  12076.  
  12077. .nosingle2
  12078.  
  12079.  move.l d5,d6
  12080.  swap d6
  12081.  
  12082.  dbra d7,acrossscrngour
  12083.  rts
  12084.  
  12085.  CNOP 0,4
  12086.  
  12087. acrossscrngour:
  12088.  move.w d5,d3
  12089.  lsr.w #8,d3
  12090.  move.b d3,d6
  12091.  move.w d0,d3
  12092.  ifeq CHEESEY
  12093.  move.b (a0,d6.w*4),d3
  12094.  endc
  12095.  ifne CHEESEY
  12096.  move.b (a0,d6.w),d3
  12097.  endc
  12098.  add.w d1,d0
  12099.  add.l d2,d5
  12100.  and.l d4,d5
  12101.  move.l d5,d6
  12102.  swap d6
  12103.  move.b (a1,d3.w),(a3)+
  12104.  move.w d5,d3
  12105.  lsr.w #8,d3
  12106.  move.b d3,d6
  12107.  move.w d0,d3
  12108.  ifeq CHEESEY
  12109.  move.b (a0,d6.w*4),d3
  12110.  endc
  12111.  ifne CHEESEY
  12112.  move.b (a0,d6.w),d3
  12113.  endc
  12114.  add.w d1,d0
  12115.  add.l d2,d5
  12116.  and.l d4,d5
  12117.  move.l d5,d6
  12118.  swap d6
  12119.  move.b (a1,d3.w),(a3)+
  12120.  move.w d5,d3
  12121.  lsr.w #8,d3
  12122.  move.b d3,d6
  12123.  move.w d0,d3
  12124.  ifeq CHEESEY
  12125.  move.b (a0,d6.w*4),d3
  12126.  endc
  12127.  ifne CHEESEY
  12128.  move.b (a0,d6.w),d3
  12129.  endc
  12130.  add.w d1,d0
  12131.  add.l d2,d5
  12132.  and.l d4,d5
  12133.  move.l d5,d6
  12134.  swap d6
  12135.  move.b (a1,d3.w),(a3)+
  12136.  move.w d5,d3
  12137.  lsr.w #8,d3
  12138.  move.b d3,d6
  12139.  move.w d0,d3
  12140.  ifeq CHEESEY
  12141.  move.b (a0,d6.w*4),d3
  12142.  endc
  12143.  ifne CHEESEY
  12144.  move.b (a0,d6.w),d3
  12145.  endc
  12146.  add.w d1,d0
  12147.  add.l d2,d5
  12148.  and.l d4,d5
  12149.  move.l d5,d6
  12150.  swap d6
  12151.  move.b (a1,d3.w),(a3)+
  12152.  dbra d7,acrossscrngour
  12153.  
  12154.  rts
  12155.  
  12156.  
  12157. gouraudfloorDOUB:
  12158.  
  12159.  move.w leftbright,d0
  12160.  move.l d1,d4
  12161.  move.w brightspd,d1
  12162.  add.w d1,d1
  12163.  add.l d2,d2
  12164.  
  12165.  move.w d7,d3
  12166.  asr.w #1,d7
  12167.  btst #0,d3
  12168.  beq.s .nosingle1
  12169.  move.w d5,d3
  12170.  move.l d5,d6
  12171.  lsr.w #8,d3
  12172.  swap d6
  12173.  move.b d3,d6
  12174.  move.w d0,d3
  12175.  ifeq CHEESEY
  12176.  move.b (a0,d6.w*4),d3
  12177.  endc
  12178.  ifne CHEESEY
  12179.  move.b (a0,d6.w),d3
  12180.  endc
  12181.  add.w d1,d0
  12182.  add.l d2,d5
  12183.  and.l d4,d5
  12184.  move.w (a1,d3.w),(a3)+
  12185. .nosingle1
  12186.  
  12187.  move.w d7,d3
  12188.  asr.w #1,d7
  12189.  btst #0,d3
  12190.  beq.s .nosingle2
  12191.  move.w d5,d3
  12192.  move.l d5,d6
  12193.  lsr.w #8,d3
  12194.  swap d6
  12195.  move.b d3,d6
  12196.  move.w d0,d3
  12197.  ifeq CHEESEY
  12198.  move.b (a0,d6.w*4),d3
  12199.  endc
  12200.  ifne CHEESEY
  12201.  move.b (a0,d6.w),d3
  12202.  endc
  12203.  add.w d1,d0
  12204.  add.l d2,d5
  12205.  and.l d4,d5
  12206.  move.l d5,d6
  12207.  swap d6
  12208.  move.w (a1,d3.w),(a3)+
  12209.  move.w d5,d3
  12210.  lsr.w #8,d3
  12211.  move.b d3,d6
  12212.  move.w d0,d3
  12213.  ifeq CHEESEY
  12214.  move.b (a0,d6.w*4),d3
  12215.  endc
  12216.  ifne CHEESEY
  12217.  move.b (a0,d6.w),d3
  12218.  endc
  12219.  add.w d1,d0
  12220.  add.l d2,d5
  12221.  and.l d4,d5
  12222.  move.w (a1,d3.w),(a3)+
  12223.  
  12224. .nosingle2
  12225.  
  12226.  move.l d5,d6
  12227.  swap d6
  12228.  
  12229.  dbra d7,acrossscrngourD
  12230.  rts
  12231.  
  12232.  CNOP 0,4
  12233.  
  12234. acrossscrngourD:
  12235.  move.w d5,d3
  12236.  lsr.w #8,d3
  12237.  move.b d3,d6
  12238.  move.w d0,d3
  12239.  ifeq CHEESEY
  12240.  move.b (a0,d6.w*4),d3
  12241.  endc
  12242.  ifne CHEESEY
  12243.  move.b (a0,d6.w),d3
  12244.  endc
  12245.  add.w d1,d0
  12246.  add.l d2,d5
  12247.  and.l d4,d5
  12248.  move.l d5,d6
  12249.  swap d6
  12250.  move.w (a1,d3.w),(a3)+
  12251.  move.w d5,d3
  12252.  lsr.w #8,d3
  12253.  move.b d3,d6
  12254.  move.w d0,d3
  12255.  ifeq CHEESEY
  12256.  move.b (a0,d6.w*4),d3
  12257.  endc
  12258.  ifne CHEESEY
  12259.  move.b (a0,d6.w),d3
  12260.  endc
  12261.  add.w d1,d0
  12262.  add.l d2,d5
  12263.  and.l d4,d5
  12264.  move.l d5,d6
  12265.  swap d6
  12266.  move.w (a1,d3.w),(a3)+
  12267.  move.w d5,d3
  12268.  lsr.w #8,d3
  12269.  move.b d3,d6
  12270.  move.w d0,d3
  12271.  ifeq CHEESEY
  12272.  move.b (a0,d6.w*4),d3
  12273.  endc
  12274.  ifne CHEESEY
  12275.  move.b (a0,d6.w),d3
  12276.  endc
  12277.  add.w d1,d0
  12278.  add.l d2,d5
  12279.  and.l d4,d5
  12280.  move.l d5,d6
  12281.  swap d6
  12282.  move.w (a1,d3.w),(a3)+
  12283.  move.w d5,d3
  12284.  lsr.w #8,d3
  12285.  move.b d3,d6
  12286.  move.w d0,d3
  12287.  ifeq CHEESEY
  12288.  move.b (a0,d6.w*4),d3
  12289.  endc
  12290.  ifne CHEESEY
  12291.  move.b (a0,d6.w),d3
  12292.  endc
  12293.  add.w d1,d0
  12294.  add.l d2,d5
  12295.  and.l d4,d5
  12296.  move.l d5,d6
  12297.  swap d6
  12298.  move.w (a1,d3.w),(a3)+
  12299.  dbra d7,acrossscrngourD
  12300.  
  12301.  rts
  12302.  
  12303.  
  12304. ;backbeforegour:
  12305. ; and.w #63*256+63,d5
  12306. ; move.b (a0,d5.w*4),d0
  12307. ; add.l d1,d0
  12308. ; bcc.s .nomoreb
  12309. ; add.w #256,d0
  12310. ;.nomoreb:
  12311. ; add.w a4,d3
  12312. ; move.w (a1,d0.w*2),(a3)+
  12313. ; addx.l d6,d5
  12314. ; dbcs d7,acrossscrngour
  12315. ; dbcc d7,backbeforegour
  12316. ; rts
  12317. ; bra.s past1gour
  12318.  
  12319. ;acrossscrngour:
  12320. ; and.l #$3f3f,d5 
  12321. ; move.b (a0,d5.w*4),d0
  12322. ; add.l d1,d0
  12323. ; bcc.s .nomoreb
  12324. ; add.w #256,d0
  12325. ;.nomoreb:
  12326. ; add.w a4,d3
  12327. ; move.w (a1,d0.w*2),(a3)+
  12328. ; addx.l d2,d5
  12329. ; dbcs d7,acrossscrngour
  12330. ; dbcc d7,backbeforegour
  12331. ;past1gour:
  12332. ; rts
  12333.  
  12334.  move.w d4,d7
  12335.  bne.s .notdoneyet
  12336.  move.l d0,leftbright
  12337.  
  12338.  rts
  12339. .notdoneyet:
  12340.  
  12341.  cmp.w #32,d7
  12342.  ble.s .notoowide
  12343.  move.w #32,d7
  12344. .notoowide
  12345.  sub.w d7,d4  
  12346.  addq #4,a3
  12347.  
  12348. ; dbra d7,backbeforegour
  12349.  rts
  12350.  
  12351.  
  12352. gotoacrossgour:
  12353.  
  12354.  move.w d4,d7
  12355.  bne.s .notdoneyet
  12356.  rts
  12357. .notdoneyet:
  12358.  
  12359.  cmp.w #32,d7
  12360.  ble.s .notoowide
  12361.  move.w #32,d7
  12362. .notoowide
  12363.  sub.w d7,d4  
  12364.  addq #4,a3
  12365.  
  12366.  dbra d7,acrossscrngour
  12367.  rts
  12368.  
  12369.  
  12370. waterpt: dc.l waterlist
  12371.  
  12372. waterlist:
  12373.  dc.l waterfile
  12374.  dc.l waterfile+2
  12375.  dc.l waterfile+256
  12376.  dc.l waterfile+256+2
  12377.  dc.l waterfile+512
  12378.  dc.l waterfile+512+2
  12379.  dc.l waterfile+768
  12380.  dc.l waterfile+768+2
  12381. ; dc.l waterfile+768
  12382. ; dc.l waterfile+512+2
  12383. ; dc.l waterfile+512
  12384. ; dc.l waterfile+256+2
  12385. ; dc.l waterfile+256
  12386. ; dc.l waterfile+2
  12387. endwaterlist:
  12388.  
  12389. watertouse: dc.l waterfile
  12390.  
  12391. wtan: dc.w 0
  12392. wateroff: dc.l 0
  12393.  
  12394. REFLECTIONWATER:
  12395.  
  12396.  move.l d1,d4
  12397.  
  12398.  add.l wateroff,d5
  12399.  
  12400.  move.l TexturePal,a1
  12401.  add.l #256*16,a1
  12402.  move.l dst,d0
  12403.  clr.b d0
  12404.  
  12405.  add.w d0,d0
  12406.  cmp.w #12*512,d0
  12407.  blt.s .notoowater
  12408.  move.w #12*512,d0
  12409.  
  12410. .notoowater:
  12411.   
  12412.  adda.w d0,a1
  12413.  
  12414.  move.l dst,d0
  12415.  asl.w #7,d0
  12416.  add.w wtan,d0
  12417.  and.w #8191,d0
  12418.  move.l #SineTable,a0
  12419.  move.w (a0,d0.w),d0
  12420.  ext.l d0
  12421.  
  12422.  move.l dst,d3
  12423.  add.w #300,d3
  12424.  divs d3,d0
  12425.  asr.w #5,d0
  12426.  addq #4,d0
  12427.  cmp.w disttobot,d0
  12428.  blt.s oknotoffbotototr
  12429.  
  12430.  move.w disttobot,d0
  12431.  subq #1,d0
  12432.  
  12433. oknotoffbotototr
  12434.  
  12435. ; move.w dst,d3
  12436. ; asr.w #7,d3
  12437. ; add.w d3,d0
  12438.  
  12439.  muls #320,d0
  12440.  tst.w above
  12441.  beq.s nonnnnnegr
  12442.  neg.l d0
  12443.  
  12444. nonnnnnegr:
  12445.  
  12446.  move.l d0,a6
  12447.  
  12448.  move.l watertouse,a0
  12449.  
  12450. ; move.l #mixtab,a5
  12451.  
  12452.  moveq #0,d1
  12453.  
  12454.  move.w startsmoothx,d3
  12455.  dbra d7,acrossscrnwr
  12456.  rts
  12457.  
  12458. backbeforewr:
  12459.  and.w d1,d5 
  12460.  move.w (a0,d5.w*4),d0
  12461.  move.b (a3,a6.w),d0
  12462.  move.w (a1,d0.w),(a3)+
  12463.  add.w a4,d3
  12464.  addx.l d6,d5
  12465.  dbcs d7,acrossscrnwr
  12466.  dbcc d7,backbeforewr
  12467.  rts
  12468.  
  12469. acrossscrnwr:
  12470.  move.w d5,d3
  12471.  move.l d5,d6
  12472.  lsr.w #8,d3
  12473.  swap d6
  12474.  move.b d3,d6
  12475.  move.w (a0,d6.w*4),d0
  12476.  add.l d2,d5
  12477.  move.w (a4,a6.w),d1
  12478.  addq #2,a4
  12479.  move.b (a3,a6.w),d1
  12480.  move.b (a5,d1.l),d0
  12481.  and.l d4,d5
  12482.  move.w (a1,d0.w),(a3)+
  12483.  dbra d7,acrossscrnwr
  12484.  rts
  12485.  
  12486. texturedwater:
  12487.  
  12488.  move.l d1,d4
  12489.  
  12490.  add.l wateroff,d5
  12491.  
  12492.  move.l TexturePal,a1
  12493.  add.l #256*16,a1
  12494.  move.l dst,d0
  12495.  asr.l #2,d0
  12496.  clr.b d0
  12497.  
  12498.  add.w d0,d0
  12499.  cmp.w #9*512,d0
  12500.  blt.s .notoowater
  12501.  move.w #9*512,d0
  12502. .notoowater:
  12503.   
  12504.  adda.w d0,a1
  12505.  
  12506.  move.l dst,d0
  12507.  asl.w #7,d0
  12508.  add.w wtan,d0
  12509.  and.w #8191,d0
  12510.  move.l #SineTable,a0
  12511.  move.w (a0,d0.w),d0
  12512.  ext.l d0
  12513.  
  12514.  move.l dst,d3
  12515.  add.w #300,d3
  12516.  divs d3,d0
  12517.  asr.w #5,d0
  12518.  addq #4,d0
  12519.  cmp.w disttobot,d0
  12520.  blt.s oknotoffbototot
  12521.  
  12522.  move.w disttobot,d0
  12523.  subq #1,d0
  12524.  
  12525. oknotoffbototot
  12526.  
  12527. ; move.w dst,d3
  12528. ; asr.w #7,d3
  12529. ; add.w d3,d0
  12530.  
  12531.  tst.b DOUBLEHEIGHT
  12532.  beq.s .nodoub
  12533.  and.b #$fe,d0
  12534. .nodoub:
  12535.  
  12536.  muls #320,d0
  12537.  tst.w above
  12538.  beq.s nonnnnneg
  12539.  neg.l d0
  12540.  
  12541. nonnnnneg:
  12542.  
  12543.  move.l d0,a6
  12544.  
  12545.  move.l watertouse,a0
  12546.  
  12547.  move.w startsmoothx,d3
  12548.  dbra d7,acrossscrnw
  12549.  rts
  12550.  
  12551. backbeforew:
  12552.  and.w d1,d5
  12553.  move.w (a0,d5.w*4),d0
  12554.  add.w d0,d0
  12555.  move.b (a3,a6.w),d0
  12556.  move.b (a1,d0.w),(a3)+
  12557.  add.w a4,d3
  12558.  addx.l d6,d5
  12559.  dbcs d7,acrossscrnw
  12560.  dbcc d7,backbeforew
  12561.  rts
  12562.  
  12563. acrossscrnw:
  12564.  move.w d5,d3
  12565.  move.l d5,d6
  12566.  lsr.w #8,d3
  12567.  swap d6
  12568.  move.b d3,d6
  12569.  move.w (a0,d6.w*4),d0
  12570.  add.w d0,d0
  12571.  add.l d2,d5
  12572.  move.b (a3,a6.w),d0
  12573.  and.l d4,d5
  12574.  move.b (a1,d0.w),(a3)+
  12575.  dbra d7,acrossscrnw
  12576.  rts
  12577.  
  12578.  
  12579. texturedwaterDOUB:
  12580.  
  12581.  move.l d1,d4
  12582.  
  12583.  add.l wateroff,d5
  12584.  
  12585.  move.l TexturePal,a1
  12586.  add.l #256*16,a1
  12587.  move.l dst,d0
  12588.  asr.l #2,d0
  12589.  clr.b d0
  12590.  
  12591.  add.w d0,d0
  12592.  cmp.w #9*512,d0
  12593.  blt.s .notoowater
  12594.  move.w #9*512,d0
  12595. .notoowater:
  12596.   
  12597.  adda.w d0,a1
  12598.  
  12599.  move.l dst,d0
  12600.  asl.w #7,d0
  12601.  add.w wtan,d0
  12602.  and.w #8191,d0
  12603.  move.l #SineTable,a0
  12604.  move.w (a0,d0.w),d0
  12605.  ext.l d0
  12606.  
  12607.  move.l dst,d3
  12608.  add.w #300,d3
  12609.  divs d3,d0
  12610.  asr.w #5,d0
  12611.  addq #4,d0
  12612.  cmp.w disttobot,d0
  12613.  blt.s .oknotoffbototot
  12614.  
  12615.  move.w disttobot,d0
  12616.  subq #1,d0
  12617.  
  12618. .oknotoffbototot
  12619.  
  12620. ; move.w dst,d3
  12621. ; asr.w #7,d3
  12622. ; add.w d3,d0
  12623.  
  12624.  tst.b DOUBLEHEIGHT
  12625.  beq.s .nodoub
  12626.  and.b #$fe,d0
  12627. .nodoub:
  12628.  
  12629.  muls #320,d0
  12630.  tst.w above
  12631.  beq.s .nonnnnneg
  12632.  neg.l d0
  12633.  
  12634. .nonnnnneg:
  12635.  
  12636.  move.l d0,a6
  12637.  
  12638.  move.l watertouse,a0
  12639.  
  12640.  add.l d2,d2
  12641.  
  12642.  move.w startsmoothx,d3
  12643.  dbra d7,acrossscrnwD
  12644.  rts
  12645.  
  12646.  
  12647. acrossscrnwD:
  12648.  move.w d5,d3
  12649.  move.l d5,d6
  12650.  lsr.w #8,d3
  12651.  swap d6
  12652.  move.b d3,d6
  12653.  move.w (a0,d6.w*4),d0
  12654.  add.w d0,d0
  12655.  add.l d2,d5
  12656.  move.b (a3,a6.w),d0
  12657.  and.l d4,d5
  12658.  move.w (a1,d0.w),(a3)+
  12659.  dbra d7,acrossscrnwD
  12660.  rts
  12661.  
  12662.  
  12663. usewater: dc.w 0
  12664.  dc.w 0
  12665. startsmoothx: dc.w 0
  12666.  dc.w 0
  12667. startsmoothz: dc.w 0
  12668.  
  12669. ********************************
  12670. *
  12671.  include "AB3:source_4000/ObjDrawHIRES.s"
  12672. *
  12673. ********************************
  12674.  
  12675. numframes:
  12676.  dc.w 0
  12677.  
  12678. alframe: dc.l 0
  12679.  
  12680. alan:
  12681.  dcb.l 8,0
  12682.  dcb.l 8,1
  12683.  dcb.l 8,2
  12684.  dcb.l 8,3
  12685. endalan:
  12686.  
  12687. alanptr: dc.l alan
  12688.  
  12689. Time2: dc.l 0
  12690. dispco:
  12691.  dc.w 0
  12692.  
  12693.  
  12694. key_readkey:
  12695.  moveq #0,d0
  12696.  move.b lastpressed,d0
  12697.  move.b #0,lastpressed
  12698.  rts
  12699.  
  12700. key_interrupt:
  12701. ;        movem.l    d0-d7/a0-a6,-(sp)
  12702.  
  12703. ;        move.w    INTREQR,d0
  12704. ;        btst    #3,d0
  12705. ;        beq    .not_key
  12706.  
  12707.         move.b    $bfdd00,d0
  12708.         btst    #0,d0
  12709.         bne    .key_cont
  12710. ;        move.b    $bfed01,d0
  12711. ;        btst    #0,d0
  12712. ;        bne    .key_cont
  12713.     
  12714. ;        btst    #3,d0
  12715. ;        beq    .key_cont
  12716.  
  12717.         move.b    $bfec01,d0
  12718.         clr.b    $bfec01
  12719.  
  12720.         tst.b    d0
  12721.         beq    .key_cont
  12722.  
  12723. ;        bset    #6,$bfee01
  12724. ;        move.b    #$f0,$bfe401
  12725. ;        move.b    #$00,$bfe501
  12726. ;        bset    #0,$bfee01
  12727.  
  12728.  
  12729.         not.b    d0
  12730.         ror.b    #1,d0
  12731.         lea.l    KeyMap,a0
  12732.         tst.b    d0
  12733.         bmi.b    .key_up
  12734.         and.w    #$7f,d0
  12735. ;        add.w    #1,d0
  12736.         move.b    #$ff,(a0,d0.w)
  12737.         move.b    d0,lastpressed
  12738.  
  12739.         bra.b    .key_cont2
  12740. .key_up:
  12741.         and.w    #$7f,d0
  12742. ;        add.w    #1,d0
  12743.         move.b    #$00,(a0,d0.w)
  12744.  
  12745. .key_cont2
  12746. ;        btst    #0,$bfed01
  12747. ;        beq    .key_cont2
  12748. ;        move.b    #%00000000,$bfee01
  12749. ;        move.b    #%10001000,$bfed01
  12750.  
  12751. ;alt keys should not be independent so overlay ralt on lalt
  12752.  
  12753.         
  12754. .key_cont
  12755.  
  12756. ;        move.w    #$0008,INTREQ
  12757. .not_key:    ;lea.l    $dff000,a5
  12758.  
  12759. ;        lea.l    _keypressed(pc),a0
  12760. ;        move.b    101(a0),d0    ;read LALT
  12761. ;        or.b    102(a0),d0    ;blend it with RALT
  12762. ;        move.b    d0,127(a0)    ;save in combined position
  12763.  
  12764. ;        movem.l    (sp)+,d0-d7/a0-a6
  12765.         move.w #0,d0
  12766.         tst.w d0
  12767.  
  12768.         rts
  12769.  
  12770. lastpressed:    dc.b 0
  12771. KInt_CCode    Ds.b    1
  12772. KInt_Askey    Ds.b    1
  12773. KInt_OCode    Ds.w    1
  12774.  
  12775.  
  12776. OldSpace: dc.b 0
  12777. SpaceTapped: dc.b 0
  12778. PLR1_SPCTAP: dc.b 0
  12779. PLR2_SPCTAP: dc.b 0
  12780. PLR3_SPCTAP: dc.b 0
  12781. PLR1_Ducked: dc.b 0
  12782. PLR2_Ducked: dc.b 0
  12783. PLR3_Ducked: dc.b 0
  12784.  even
  12785.  
  12786. PLR1_Squished: dc.w 0
  12787. PLR2_Squished: dc.w 0
  12788. PLR1s_SquishedHeight: dc.l 0
  12789. PLR2s_SquishedHeight: dc.l 0
  12790. PLR3s_SquishedHeight: dc.l 0
  12791.  
  12792.  include "ab3:source_4000/multiPLR1CONTROL.s"
  12793.  include "ab3:source_4000/multiPLR2CONTROL.s"
  12794.  include "ab3:source_4000/PLR3CONTROL.s"
  12795.  include "ab3:source_4000/multiFALL.s"
  12796.  
  12797.  
  12798.  
  12799. *******************************************8
  12800.  
  12801. nullmessage: dcb.b 160,' '
  12802.  
  12803. SENDMESSAGENORET
  12804.  move.l a1,-(a7)
  12805.  bra intosend
  12806.  
  12807. SENDMESSAGE:
  12808.  
  12809.  move.l a1,-(a7)
  12810.  
  12811.  move.l MESSPTR,a1
  12812.  move.l d0,(a1)+
  12813.  cmp.l #ENDMESSBUFF,a1
  12814.  blt.s .okinbuff
  12815.  move.l #MESSAGEBUFFER,a1
  12816. .okinbuff:
  12817.  move.l a1,MESSPTR
  12818.  move.l a1,LASTMESSPTR
  12819.  
  12820. intosend:
  12821.  
  12822.  move.l d0,SCROLLPOINTER
  12823.  move.w #0,SCROLLXPOS
  12824.  add.l #160,d0
  12825.  move.l d0,ENDSCROLL
  12826.  move.w #40,SCROLLTIMER
  12827.  
  12828.  move.l (a7)+,a1
  12829.  rts
  12830.  
  12831. RETRIEVEPREVMESSAGE:
  12832.  
  12833.  move.l LASTMESSPTR,a1
  12834.  cmp.l #MESSAGEBUFFER,a1
  12835.  bgt.s .okinbuff
  12836.  
  12837.  move.l #ENDMESSBUFF,a1
  12838.  
  12839. .okinbuff:
  12840.  
  12841.  move.l -(a1),d0
  12842.  beq.s .nomessage
  12843.  
  12844.  move.l d0,SCROLLPOINTER
  12845.  move.w #0,SCROLLXPOS
  12846.  add.l #160,d0
  12847.  move.l d0,ENDSCROLL
  12848.  move.w #40,SCROLLTIMER
  12849.  
  12850.  move.l a1,LASTMESSPTR
  12851.  
  12852. .nomessage:
  12853.  
  12854.  
  12855.  rts
  12856.  
  12857. MESSAGEBUFFER:
  12858.  ds.l 20
  12859. ENDMESSBUFF:
  12860.  
  12861. MESSPTR: dc.l MESSAGEBUFFER
  12862. LASTMESSPTR: dc.l MESSAGEBUFFER
  12863.  
  12864. **********************************************
  12865.  
  12866.  
  12867.  
  12868. prot7: dc.w 0
  12869.  
  12870. GOTTOSEND: dc.w 0
  12871.  
  12872. COUNTER: dc.w 0
  12873. COUNTER2: dc.w 0
  12874. COUNTSPACE: ds.b 160
  12875.  
  12876. OtherInter:
  12877.  move.w #$0010,$dff000+intreq
  12878.  movem.l d0-d7/a0-a6,-(a7)
  12879.  bra justshake
  12880.  
  12881.     cnop 0,4
  12882.  
  12883. BlitterInterrupt:
  12884.  
  12885.  movem.l d0-d7/a0-a6,-(a7)
  12886.  move.w    #$0040,$dff09c        ; Clear REQ bits
  12887.  
  12888.  move.l main_bltint,d0
  12889.  beq.s .noint
  12890.  move.l d0,a0
  12891.  jsr (a0)
  12892. .noint:
  12893.  movem.l (a7)+,d0-d7/a0-a6
  12894.  
  12895.  rts
  12896.  
  12897. Chan0inter:
  12898.  
  12899.     add.l #1,counter
  12900.     add.l #1,main_counter
  12901.     tst.l timer
  12902.     beq.s .nodec
  12903.     subq.l #1,timer    
  12904. .nodec:
  12905.  
  12906.     SAVEREGS
  12907.     jsr    .routine
  12908.  
  12909.     move.l main_vblint,d0
  12910.     beq.s .noint
  12911.         move.l d0,a0
  12912.         jsr (a0)    
  12913. .noint:
  12914.  
  12915.     GETREGS
  12916. ;    move.w    #1024+'.',$dff030
  12917.     
  12918.     moveq #1,d0
  12919.     rts
  12920.  
  12921. .routine
  12922.  
  12923.     
  12924. ;w move.w #$0010,$dff000+intreq
  12925.  
  12926.  tst.b doanything
  12927.  bne dosomething
  12928.  
  12929.  movem.l d0-d7/a0-a6,-(a7)
  12930.  bra JUSTSOUNDS
  12931.  
  12932.  rts
  12933.  
  12934. tabheld: dc.w 0
  12935. ObjWork: ds.l 600
  12936. WORKPTR: dc.l 0
  12937. thistime: dc.w 0
  12938.  
  12939. DOALLANIMS:
  12940.  
  12941.  sub.b #1,thistime
  12942.  ble.s .okdosome
  12943.  rts
  12944.  
  12945. .okdosome:
  12946.  move.b #5,thistime
  12947.  
  12948.  
  12949.  move.l #ObjWork,a5
  12950.  move.l ObjectData,a0
  12951. Objectloop2:
  12952.  tst.w (a0)
  12953.  blt doneallobj2
  12954.  move.w 12(a0),d0
  12955.  blt doneobj2
  12956.  move.w d0,GraphicRoom(a0)
  12957.  tst.b worry(a0)
  12958.  beq.s doneobj2
  12959.  
  12960.  move.b 16(a0),d0
  12961.  cmp.b #1,d0
  12962.  blt JUMPALIENANIM
  12963. ; beq JUMPOBJECTANIM
  12964. ; cmp.b #2,d0
  12965. ; beq JUMPBULLET
  12966.  
  12967. doneobj2:
  12968.  
  12969.  adda.w #64,a0
  12970.  addq #8,a5
  12971.  bra Objectloop2
  12972.  
  12973. doneallobj2:
  12974.  rts
  12975.  
  12976. JUMPALIENANIM:
  12977.  
  12978.  moveq #0,d0
  12979.  move.b WhichAnim(a0),d0
  12980. ; 0=walking
  12981. ; 1=attacking
  12982. ; 2=getting hit
  12983. ; 3=dying
  12984.  
  12985.  cmp.b #1,d0
  12986.  blt.s ALWALK
  12987.  beq.s ALATTACK
  12988.  
  12989.  cmp.b #3,d0
  12990.  blt ALGETHIT
  12991.  beq ALDIE
  12992.  
  12993.  bra doneobj2
  12994.  
  12995. ALDIE
  12996.  move.l #10,d0
  12997.  bra intowalk
  12998.  
  12999. ALGETHIT:
  13000.  move.l #9,d0
  13001.  bra intowalk
  13002.  
  13003. ALATTACK:
  13004.  move.l #8,d0
  13005.  bra intowalk
  13006.  
  13007. AUXOBJ: dc.w 0
  13008.  
  13009. ALWALK:
  13010.  
  13011. ; jsr ViewpointToDraw
  13012. ; add.l d0,d0
  13013. ; move.l LINKFILE,a6
  13014. ; add.l #AlienStats,a6
  13015. ; moveq #0,d1
  13016. ; move.b TypeOfThing(a0),d1
  13017. ; muls #AlienStatLen,d1
  13018. ; add.l d1,a6
  13019. ; cmp.w #1,A_GFXType(a6)
  13020. ; bne.s NOSIDES2
  13021.  
  13022.  moveq #0,d0
  13023. intowalk:
  13024.  
  13025. NOSIDES2:
  13026.  
  13027.  move.b d0,2(a5)
  13028.  move.l LINKFILE,a6
  13029.  
  13030.  add.l #AlienAnimData,a6
  13031.  
  13032.  moveq #0,d1
  13033.  move.b TypeOfThing(a0),d1
  13034.  move.w .valtables+4(pc,d1.w*8),d1
  13035. ; muls #A_AnimLen,d1
  13036.  add.l d1,a6
  13037.  
  13038. ; move.l ANIMPOINTER,a6
  13039.  
  13040. ; muls #A_OptLen,d0
  13041.  move.w .valtables+2(pc,d0.w*8),d0
  13042.  add.w d0,a6
  13043.  
  13044.  move.w SecTimer(a0),d1
  13045.  move.w d1,d2
  13046. ; muls #A_FrameLen,d1
  13047.  move.w .valtables(pc,d1.w*8),d1
  13048.  
  13049.  moveq #0,d0
  13050.  move.b 5(a6,d1.w),d0
  13051.  beq.s .nosoundmake
  13052.  
  13053.  movem.l d0-d7/a0-a6,-(a7)
  13054.  subq #1,d0
  13055.  move.w d0,Samplenum
  13056.  clr.b notifplaying
  13057.  move.w (a0),IDNUM
  13058.  move.w #80,Noisevol
  13059.  move.l #ObjRotated,a1
  13060.  move.w (a0),d0
  13061.  lea (a1,d0.w*8),a1
  13062.  move.l (a1),Noisex
  13063.  jsr MakeSomeNoise
  13064.  movem.l (a7)+,d0-d7/a0-a6
  13065. .nosoundmake
  13066.  
  13067.  move.b 6(a6,d1.w),d0
  13068.  beq.s .noaction
  13069.  add.b #1,(a5)
  13070.  move.b d2,1(a5)
  13071. .noaction
  13072.  
  13073.  addq #1,d2
  13074.  
  13075.  moveq #0,d0
  13076.  move.b 7(a6,d1.w),d0
  13077.  beq .nospecial
  13078.  bra .special
  13079.  
  13080. .valtables:
  13081. val SET 0
  13082.  REPT 20
  13083.  dc.w A_FrameLen*val,A_OptLen*val
  13084.  dc.w A_AnimLen*val,0
  13085. val SET val+1
  13086.  ENDR
  13087.  
  13088. .special
  13089.  move.b d0,d3
  13090.  and.w #63,d3
  13091.  lsr.w #6,d0
  13092.  cmp.w #2,d0
  13093.  blt.s .storeval
  13094.  beq.s .randval
  13095.  
  13096.  sub.b #1,4(a5)
  13097.  beq.s .nospecial
  13098.  
  13099.  move.w d3,d2
  13100.  bra.s .nospecial
  13101.  
  13102. .randval:
  13103.  jsr GetRand
  13104.  divs d3,d0
  13105.  swap d0
  13106.  move.w d0,d3
  13107.  
  13108. .storeval:
  13109.  move.b d3,4(a5)
  13110. .nospecial:
  13111.  
  13112. ; move.w d2,d3
  13113.  move.w .valtables2(pc,d2.w*8),d3
  13114. ; muls #A_FrameLen,d3
  13115.  tst.b (a6,d3.w)
  13116.  bge.s .noendanim
  13117.  st 3(a5)
  13118.  move.w #0,d2
  13119. .noendanim
  13120.  move.w d2,SecTimer(a0)
  13121.  
  13122.  bra doneobj2
  13123.  
  13124. .valtables2:
  13125. val SET 0
  13126.  REPT 20
  13127.  dc.w A_FrameLen*val,A_OptLen*val
  13128.  dc.w A_AnimLen*val,0
  13129. val SET val+1
  13130.  ENDR
  13131.  
  13132.  
  13133. JUMPOBJECTANIM:
  13134.  bra doneobj2
  13135.  
  13136. timetodamage: dc.w 0
  13137. SAVESAVE: dc.w 0
  13138.  
  13139. dosomething:
  13140.  
  13141.  
  13142.  
  13143.  addq.w #1,FramesToDraw
  13144.  movem.l d0-d7/a0-a6,-(a7)
  13145.  
  13146.  jsr NARRATOR
  13147.  
  13148.  bsr DOALLANIMS
  13149.  
  13150.  sub.w #1,timetodamage
  13151.  bgt .nodam
  13152.  
  13153.  move.w #100,timetodamage
  13154.  
  13155.  move.l PLR1_Roompt,a0
  13156.  move.w ToFloorNoise(a0),d0
  13157.  tst.b PLR1_StoodInTop
  13158.  beq.s .okinbot
  13159.  move.w ToUpperFloorNoise(a0),d0
  13160. .okinbot:
  13161.  
  13162.  move.l LINKFILE,a0
  13163.  add.l #FloorData,a0
  13164.  move.w (a0,d0.w*4),d0    ; damage. 
  13165.  move.l PLR1_Obj,a0
  13166.  add.b d0,damagetaken(a0)
  13167.  
  13168.  move.l PLR2_Roompt,a0
  13169.  move.w ToFloorNoise(a0),d0
  13170.  tst.b PLR2_StoodInTop
  13171.  beq.s .okinbot2
  13172.  move.w ToUpperFloorNoise(a0),d0
  13173. .okinbot2:
  13174.  
  13175.  move.l LINKFILE,a0
  13176.  add.l #FloorData,a0
  13177.  move.w (a0,d0.w*4),d0    ; damage. 
  13178.  
  13179.  move.l PLR2_Obj,a0
  13180.  add.b d0,damagetaken(a0)
  13181.  
  13182.  move.l PLR3_Roompt,a0
  13183.  move.w ToFloorNoise(a0),d0
  13184.  tst.b PLR3_StoodInTop
  13185.  beq.s .okinbot3
  13186.  move.w ToUpperFloorNoise(a0),d0
  13187. .okinbot3:
  13188.  
  13189.  move.l LINKFILE,a0
  13190.  add.l #FloorData,a0
  13191.  move.w (a0,d0.w*4),d0    ; damage. 
  13192.  
  13193.  move.l PLR3_Obj,a0
  13194.  add.b d0,damagetaken(a0)
  13195.  
  13196.  
  13197. .nodam:
  13198.  
  13199.  move.l #KeyMap,a5
  13200.  
  13201.  tst.b 82(a5)    ;f3
  13202.  beq notogglesound
  13203.  
  13204.  tst.b lasttogsound
  13205.  bne notogglesound2
  13206.  
  13207.  st lasttogsound
  13208.  
  13209.  move.w TOPPOPT,d0
  13210.  addq #1,d0
  13211.  and.w #3,d0
  13212.  move.w d0,TOPPOPT
  13213.  move.b STEROPT(pc,d0.w*2),STEREO
  13214.  
  13215.  
  13216.  move.b STEROPT+1(pc,d0.w*2),d1
  13217.  muls #160,d0
  13218.  add.l #SOUNDOPTSTEXT,d0
  13219.  jsr SENDMESSAGE
  13220.  
  13221.  
  13222.  move.b d1,Prefsfile+1
  13223.  
  13224.  bra pastster
  13225.  
  13226.  STEROPT:
  13227.  dc.b 0,4
  13228.  dc.b $FF,4
  13229.  dc.b 0,8
  13230.  dc.b $ff,8
  13231.  
  13232. lasttogsound: dc.w 0
  13233.  
  13234. SOUNDOPTSTEXT:
  13235. ;      1234567890123456789012345678901234567890
  13236.  dc.b "Four Channel Mono Selected              "
  13237.  dc.b "                                        "
  13238.  dc.b "                                        "
  13239.  dc.b "                                        "
  13240.  
  13241.  dc.b "Four Channel Stereo Selected            "
  13242.  dc.b "                                        "
  13243.  dc.b "                                        "
  13244.  dc.b "                                        "
  13245.  
  13246.  dc.b "Eight Channel Mono Selected             "
  13247.  dc.b "                                        "
  13248.  dc.b "                                        "
  13249.  dc.b "                                        "
  13250.  
  13251.  dc.b "Eight Channel Stereo Selected           "
  13252.  dc.b "                                        "
  13253.  dc.b "                                        "
  13254.  dc.b "                                        "
  13255.  
  13256. LIGHTING: dc.w $FFff
  13257. OLDLTOG: dc.w 0
  13258.  
  13259. pastster:
  13260.  
  13261.  cmp.b #'4',d1
  13262.  seq.s CHANNELDATA+8
  13263.  seq.s CHANNELDATA+12
  13264.  seq.s CHANNELDATA+24
  13265.  seq.s CHANNELDATA+28
  13266.  
  13267. * Mt_init *********************
  13268.  st CHANNELDATA+8
  13269.  st CHANNELDATA
  13270. *******************************
  13271.  
  13272.  move.w #$f,$dff000+dmacon
  13273.  move.l #null,$dff0a0
  13274.  move.w #100,$dff0a4
  13275.  move.w #443,$dff0a6
  13276.  move.w #63,$dff0a8
  13277.  
  13278.  move.l #null2,$dff0b0
  13279.  move.w #100,$dff0b4
  13280.  move.w #443,$dff0b6
  13281.  move.w #63,$dff0b8
  13282.  
  13283.  move.l #null4,$dff0c0
  13284.  move.w #100,$dff0c4
  13285.  move.w #443,$dff0c6
  13286.  move.w #63,$dff0c8
  13287.  
  13288.  move.l #null3,$dff0d0
  13289.  move.w #100,$dff0d4
  13290.  move.w #443,$dff0d6
  13291.  move.w #63,$dff0d8
  13292.  
  13293.  move.l #empty,pos0LEFT
  13294.  move.l #empty,pos1LEFT
  13295.  move.l #empty,pos2LEFT
  13296.  move.l #empty,pos3LEFT
  13297.  move.l #empty,pos0RIGHT
  13298.  move.l #empty,pos1RIGHT
  13299.  move.l #empty,pos2RIGHT
  13300.  move.l #empty,pos3RIGHT
  13301.  move.l #emptyend,Samp0endLEFT
  13302.  move.l #emptyend,Samp1endLEFT
  13303.  move.l #emptyend,Samp2endLEFT
  13304.  move.l #emptyend,Samp3endLEFT
  13305.  move.l #emptyend,Samp0endRIGHT
  13306.  move.l #emptyend,Samp1endRIGHT
  13307.  move.l #emptyend,Samp2endRIGHT
  13308.  move.l #emptyend,Samp3endRIGHT
  13309.  
  13310.  move.w #10,d3
  13311. .willy
  13312.  btst #0,$dff000+intreqrl
  13313.  beq.s .willy
  13314.  move.w #1,$dff000+intreq
  13315.  
  13316.  dbra d3,.willy
  13317.  
  13318.  move.w #$820f,$dff000+dmacon
  13319.  
  13320.  bra notogglesound2
  13321.  
  13322. Prefsfile:
  13323.  dc.b 'k4nx'
  13324.  
  13325. notogglesound:
  13326.  clr.b lasttogsound
  13327. notogglesound2:
  13328.  
  13329.  
  13330.  tst.b 83(a5)
  13331.  beq nolighttoggle
  13332.  tst.b OLDLTOG
  13333.  bne nolighttoggle2
  13334.  st OLDLTOG
  13335.  
  13336.  move.l #LIGHTINGTEXT,d0
  13337.  not.b LIGHTING
  13338.  beq.s .noon
  13339.  add.l #160,d0
  13340. .noon:
  13341.  bra pastlighttext
  13342.  
  13343. LIGHTINGTEXT:
  13344.  dc.b "Lighting Effects Deactivated            "
  13345.  dc.b "                                        "
  13346.  dc.b "                                        "
  13347.  dc.b "                                        "
  13348.  
  13349.  dc.b "Lighting Effects Activated              "
  13350.  dc.b "                                        "
  13351.  dc.b "                                        "
  13352.  dc.b "                                        "
  13353.  
  13354. OLDRET: dc.w 0
  13355. OLDCENT: dc.w 0
  13356. OLDGOOD: dc.w 0
  13357.  
  13358. GOODRENDERTXT:
  13359.  dc.b "Rendering Quality : High                "
  13360.  dc.b "                                        "
  13361.  dc.b "                                        "
  13362.  dc.b "                                        "
  13363. BADRENDERTXT:
  13364.  dc.b "Rendering Quality : Reduced             "
  13365.  dc.b "                                        "
  13366.  dc.b "                                        "
  13367.  dc.b "                                        "
  13368.  
  13369. pastlighttext:
  13370.  
  13371.  jsr SENDMESSAGE
  13372.  
  13373. ; move.l d0,SCROLLPOINTER
  13374. ; move.w #0,SCROLLXPOS
  13375. ; add.l #160,d0
  13376. ; move.l d0,ENDSCROLL
  13377. ; move.w #40,SCROLLTIMER 
  13378.  
  13379.  bra nolighttoggle2
  13380.  
  13381. nolighttoggle:
  13382.  clr.b OLDLTOG
  13383. nolighttoggle2:
  13384.  
  13385.  
  13386.  tst.b 84(a5)
  13387.  beq.s noret
  13388.  tst.b OLDRET
  13389.  bne.s noret2
  13390.  st OLDRET
  13391.  
  13392.  jsr RETRIEVEPREVMESSAGE
  13393.  
  13394.  bra noret2
  13395.  
  13396. noret
  13397.  clr.b OLDRET
  13398. noret2:
  13399.  
  13400.  tst.b 85(a5)
  13401.  beq.s .nogood
  13402.  tst.b OLDGOOD
  13403.  bne.s .nogood2
  13404.  st OLDGOOD
  13405.  
  13406.  move.l #GOODRENDERTXT,d0
  13407.  not.b GOODRENDER
  13408.  bne.s .okgood
  13409.  move.l #BADRENDERTXT,d0
  13410. .okgood:
  13411.  
  13412.  jsr SENDMESSAGE
  13413.  
  13414.  bra .nogood2
  13415.  
  13416. .nogood
  13417.  clr.b OLDGOOD
  13418. .nogood2:
  13419.  
  13420.  
  13421.  tst.b $42(a5)
  13422.  bne.s .tabprsd
  13423.  clr.b tabheld
  13424.  bra.s .noswitch
  13425.  
  13426. .tabprsd:
  13427.  tst.b tabheld
  13428.  bne.s .noswitch
  13429.  not.b MAPON
  13430.  st tabheld
  13431. .noswitch
  13432.  
  13433.  tst.b $3e(a5)
  13434.  sne d0
  13435.  tst.b $1e(a5)
  13436.  sne d1
  13437.  tst.b $2d(a5)
  13438.  sne d2
  13439.  tst.b $2f(a5)
  13440.  sne d3
  13441.  
  13442.  tst.b $3d(a5)
  13443.  sne d4
  13444.  tst.b $3f(a5)
  13445.  sne d5
  13446.  tst.b $1d(a5)
  13447.  sne d6
  13448.  tst.b $1f(a5)
  13449.  sne d7
  13450.  
  13451.  or.b d4,d0
  13452.  or.b d5,d0
  13453.  or.b d6,d1
  13454.  or.b d7,d1
  13455.  or.b d4,d2
  13456.  or.b d6,d2
  13457.  or.b d7,d3
  13458.  or.b d5,d3
  13459.  
  13460.  move.w MAPBRIGHT,d4
  13461.  add.w #2,d4
  13462.  clr.l d5
  13463.  bset d4,d5
  13464.  
  13465.  tst.b d0
  13466.  beq.s .nomapup
  13467.  sub.w d5,mapzoff
  13468. .nomapup 
  13469.  
  13470.  tst.b d1
  13471.  beq.s .nomapdown
  13472.  add.w d5,mapzoff
  13473. .nomapdown 
  13474.  
  13475.  tst.b d2
  13476.  beq.s .nomapleft
  13477.  add.w d5,mapxoff
  13478. .nomapleft 
  13479.  
  13480.  tst.b d3
  13481.  beq.s .nomapright
  13482.  sub.w d5,mapxoff
  13483. .nomapright 
  13484.  
  13485.  tst.b $2e(a5)
  13486.  beq.s .nomapcentre
  13487.  
  13488.  move.w #0,mapxoff
  13489.  move.w #0,mapzoff
  13490.  
  13491. .nomapcentre
  13492.  
  13493. ; move.w STOPOFFSET,d0
  13494. ; tst.b 27(a5)
  13495. ; beq.s .nolookup
  13496. ; sub.w #5,d0
  13497. ; cmp.w #-80,d0
  13498. ; bgt.s .nolookup
  13499. ; move.w #-80,d0
  13500. ;.nolookup:
  13501. ; tst.b 42(a5)
  13502. ; beq.s .nolookdown
  13503. ; add.w #5,d0
  13504. ; cmp.w #80,d0
  13505. ; blt.s .nolookdown
  13506. ; move.w #80,d0
  13507. ;.nolookdown:
  13508. ;
  13509. ; move.w d0,STOPOFFSET
  13510. ; neg.w d0
  13511. ; add.w #120,d0
  13512. ; move.w d0,SMIDDLEY
  13513. ; muls #320*2,d0
  13514. ; move.l d0,SBIGMIDDLEY
  13515.  
  13516.  
  13517. ; jsr INITREC
  13518. ; jsr RECEIVE
  13519.  
  13520. ; tst.l BUFFER
  13521. ; beq.s justshake
  13522. ; st GOTTOSEND
  13523. ; move.l #OtherInter,$6c
  13524.  
  13525. justshake:
  13526.  
  13527. ; cmp.b #'b',Prefsfile+3
  13528. ; bne.s .noback
  13529.  
  13530.  
  13531.  jsr mt_music
  13532.  
  13533.  
  13534.  
  13535. ;.noback:
  13536.  
  13537.  bra dontshowtime
  13538.  
  13539.  tst.b oktodisplay
  13540.  beq dontshowtime
  13541.  clr.b oktodisplay
  13542.  subq.w #1,dispco
  13543.  bgt dontshowtime
  13544.  move.w #10,dispco
  13545.  
  13546.  move.l #TimerScr+10,a0
  13547.  move.l TimeCount,d0
  13548.  bge.s timenotneg
  13549.  move.l #1111*256,d0
  13550. timenotneg:
  13551.  asr.l #8,d0
  13552.  move.l #digits,a1
  13553.  move.w #7,d2
  13554. digitlop
  13555.  divs #10,d0
  13556.  swap d0
  13557.  lea (a1,d0.w*8),a2
  13558.  move.b (a2)+,(a0)
  13559.  move.b (a2)+,24(a0)
  13560.  move.b (a2)+,24*2(a0)
  13561.  move.b (a2)+,24*3(a0)
  13562.  move.b (a2)+,24*4(a0)
  13563.  move.b (a2)+,24*5(a0)
  13564.  move.b (a2)+,24*6(a0)
  13565.  move.b (a2)+,24*7(a0)
  13566.  subq #1,a0
  13567.  swap d0
  13568.  ext.l d0
  13569.  dbra d2,digitlop
  13570.  
  13571.  move.l #TimerScr+10+24*10,a0
  13572.  move.l NumTimes,d0
  13573.  move.l #digits,a1
  13574.  move.w #3,d2
  13575. digitlop2
  13576.  divs #10,d0
  13577.  swap d0
  13578.  lea (a1,d0.w*8),a2
  13579.  move.b (a2)+,(a0)
  13580.  move.b (a2)+,24(a0)
  13581.  move.b (a2)+,24*2(a0)
  13582.  move.b (a2)+,24*3(a0)
  13583.  move.b (a2)+,24*4(a0)
  13584.  move.b (a2)+,24*5(a0)
  13585.  move.b (a2)+,24*6(a0)
  13586.  move.b (a2)+,24*7(a0)
  13587.  subq #1,a0
  13588.  swap d0
  13589.  ext.l d0
  13590.  dbra d2,digitlop2
  13591.  
  13592.  move.l #TimerScr+10+24*20,a0
  13593.  moveq #0,d0
  13594.  move.w FramesToDraw,d0
  13595.  move.l #digits,a1
  13596.  move.w #2,d2
  13597. digitlop3
  13598.  divs #10,d0
  13599.  swap d0
  13600.  lea (a1,d0.w*8),a2
  13601.  move.b (a2)+,(a0)
  13602.  move.b (a2)+,24(a0)
  13603.  move.b (a2)+,24*2(a0)
  13604.  move.b (a2)+,24*3(a0)
  13605.  move.b (a2)+,24*4(a0)
  13606.  move.b (a2)+,24*5(a0)
  13607.  move.b (a2)+,24*6(a0)
  13608.  move.b (a2)+,24*7(a0)
  13609.  subq #1,a0
  13610.  swap d0
  13611.  ext.l d0
  13612.  dbra d2,digitlop3
  13613.  
  13614. dontshowtime:
  13615.  
  13616.  
  13617.  move.l alanptr,a0
  13618.  move.l (a0)+,alframe
  13619.  cmp.l #endalan,a0
  13620.  blt.s nostartalan
  13621.  move.l #alan,a0
  13622. nostartalan:
  13623.  move.l a0,alanptr
  13624.  
  13625.  
  13626.  tst.b READCONTROLS
  13627.  beq nocontrols
  13628.  
  13629.  cmp.b #'2',WHICHAMI
  13630.  beq control2
  13631.  bgt control3
  13632.  
  13633.  tst.w PLAYERONEHEALTH
  13634.  bgt .propercontrol
  13635.  
  13636.  move.l #7*2116,hitcol
  13637.  move.l GUN_OBJ,a0
  13638.  move.w #-1,12(a0)
  13639.  
  13640.  clr.b PLR1_fire
  13641.  clr.b PLR1_clicked
  13642.  move.w #0,ADDTOBOBBLE
  13643.  move.l #playercrouched,PLR1s_height
  13644.  move.w #-80,d0
  13645.  move.w d0,STOPOFFSET
  13646.  neg.w d0
  13647.  add.w TOTHEMIDDLE,d0
  13648.  move.w d0,SMIDDLEY
  13649.  muls #320,d0
  13650.  move.l d0,SBIGMIDDLEY
  13651.  jsr PLR1_fall
  13652.  
  13653.  move.l PLR1s_xspdval,d6
  13654.  move.l PLR1s_zspdval,d7
  13655.  
  13656.  tst.b SLOWDOWN
  13657.  beq.s .nofriction
  13658.  
  13659.  neg.l d6
  13660.  ble.s .nobug1
  13661.  asr.l #3,d6
  13662.  add.l #1,d6
  13663.  bra.s .bug1
  13664. .nobug1
  13665.  asr.l #3,d6
  13666. .bug1:
  13667.  
  13668.  neg.l d7
  13669.  ble.s .nobug2
  13670.  asr.l #3,d7
  13671.  add.l #1,d7
  13672.  bra.s .bug2
  13673. .nobug2
  13674.  asr.l #3,d7
  13675. .bug2: 
  13676.  
  13677.  add.l d6,PLR1s_xspdval
  13678.  add.l d7,PLR1s_zspdval
  13679.  
  13680. .nofriction:
  13681.  move.l PLR1s_xspdval,d6
  13682.  move.l PLR1s_zspdval,d7
  13683.  add.l d6,PLR1s_xoff
  13684.  add.l d7,PLR1s_zoff
  13685.  
  13686.  move.w PLR1s_angspd,d3
  13687.  tst.b SLOWDOWN
  13688.  beq.s .nofric
  13689.  asr.w #2,d3
  13690.  bge.s .nneg
  13691.  addq #1,d3
  13692. .nneg:
  13693. .nofric:
  13694.  
  13695.  move.w d3,PLR1s_angspd
  13696.  add.w d3,PLR1s_angpos
  13697.  add.w d3,PLR1s_angpos
  13698.  and.w #8190,PLR1s_angpos
  13699.  
  13700.  bra nocontrols
  13701.  
  13702. .propercontrol:
  13703.  
  13704.  tst.b PLR1MOUSE
  13705.  beq.s PLR1_nomouse
  13706.  bsr PLR1_mouse_control
  13707. PLR1_nomouse:
  13708.  tst.b PLR1KEYS
  13709.  beq.s PLR1_nokeys
  13710.  bsr PLR1_keyboard_control
  13711. PLR1_nokeys:
  13712. ; tst.b PLR1PATH
  13713. ; beq.s PLR1_nopath
  13714. ; bsr PLR1_follow_path
  13715. ;PLR1_nopath:
  13716.  tst.b PLR1JOY
  13717.  beq.s PLR1_nojoy
  13718.  bsr PLR1_JoyStick_control
  13719. PLR1_nojoy: 
  13720.  bra nocontrols
  13721.  
  13722. control2:
  13723.  
  13724.  tst.w PLAYERTWOHEALTH
  13725.  bgt .propercontrol
  13726.  
  13727.  move.l #7*2116,hitcol
  13728.  move.l GUN_OBJ,a0
  13729.  move.w #-1,12(a0)
  13730.  clr.b PLR2_fire
  13731.  move.w #0,ADDTOBOBBLE
  13732.  move.l #playercrouched,PLR2s_height
  13733.  move.w #-80,d0
  13734.  move.w d0,STOPOFFSET
  13735.  neg.w d0
  13736.  add.w TOTHEMIDDLE,d0
  13737.  move.w d0,SMIDDLEY
  13738.  muls #320,d0
  13739.  move.l d0,SBIGMIDDLEY
  13740.  jsr PLR2_fall
  13741.  
  13742.  move.l PLR2s_xspdval,d6
  13743.  move.l PLR2s_zspdval,d7
  13744.  
  13745.  tst.b SLOWDOWN
  13746.  beq.s .nofriction
  13747.  
  13748.  neg.l d6
  13749.  ble.s .nobug1
  13750.  asr.l #3,d6
  13751.  add.l #1,d6
  13752.  bra.s .bug1
  13753. .nobug1
  13754.  asr.l #3,d6
  13755. .bug1:
  13756.  
  13757.  neg.l d7
  13758.  ble.s .nobug2
  13759.  asr.l #3,d7
  13760.  add.l #1,d7
  13761.  bra.s .bug2
  13762. .nobug2
  13763.  asr.l #3,d7
  13764. .bug2: 
  13765.  
  13766.  add.l d6,PLR2s_xspdval
  13767.  add.l d7,PLR2s_zspdval
  13768.  
  13769. .nofriction:
  13770.  move.l PLR2s_xspdval,d6
  13771.  move.l PLR2s_zspdval,d7
  13772.  add.l d6,PLR2s_xoff
  13773.  add.l d7,PLR2s_zoff
  13774.  
  13775.  move.w PLR2s_angspd,d3
  13776.  tst.b SLOWDOWN
  13777.  beq.s .nofric
  13778.  asr.w #2,d3
  13779.  bge.s .nneg
  13780.  addq #1,d3
  13781. .nneg:
  13782. .nofric:
  13783.  
  13784.  move.w d3,PLR2s_angspd
  13785.  add.w d3,PLR2s_angpos
  13786.  add.w d3,PLR2s_angpos
  13787.  and.w #8190,PLR2s_angpos
  13788.  
  13789.  bra nocontrols
  13790.  
  13791. .propercontrol:
  13792.  tst.b PLR2MOUSE
  13793.  beq.s PLR2_nomouse
  13794.  bsr PLR2_mouse_control
  13795. PLR2_nomouse:
  13796.  tst.b PLR2KEYS
  13797.  beq.s PLR2_nokeys
  13798.  bsr PLR2_keyboard_control
  13799. PLR2_nokeys:
  13800. ; tst.b PLR2PATH
  13801. ; beq.s PLR2_nopath
  13802. ; bsr PLR1_follow_path
  13803. ;PLR2_nopath:
  13804.  tst.b PLR2JOY
  13805.  beq.s PLR2_nojoy
  13806.  bsr PLR2_JoyStick_control
  13807. PLR2_nojoy: 
  13808.  
  13809.  bra nocontrols
  13810.  
  13811. control3:
  13812.  
  13813.  tst.w PLAYERTHREEHEALTH
  13814.  bgt .propercontrol
  13815.  
  13816.  move.l #7*2116,hitcol
  13817.  move.l GUN_OBJ,a0
  13818.  move.w #-1,12(a0)
  13819.  clr.b PLR3_fire
  13820.  move.w #0,ADDTOBOBBLE
  13821.  move.l #playercrouched,PLR3s_height
  13822.  move.w #-80,d0
  13823.  move.w d0,STOPOFFSET
  13824.  neg.w d0
  13825.  add.w TOTHEMIDDLE,d0
  13826.  move.w d0,SMIDDLEY
  13827.  muls #320,d0
  13828.  move.l d0,SBIGMIDDLEY
  13829.  jsr PLR3_fall
  13830.  
  13831.  move.l PLR3s_xspdval,d6
  13832.  move.l PLR3s_zspdval,d7
  13833.  
  13834.  tst.b SLOWDOWN
  13835.  beq.s .nofriction
  13836.  
  13837.  neg.l d6
  13838.  ble.s .nobug1
  13839.  asr.l #3,d6
  13840.  add.l #1,d6
  13841.  bra.s .bug1
  13842. .nobug1
  13843.  asr.l #3,d6
  13844. .bug1:
  13845.  
  13846.  neg.l d7
  13847.  ble.s .nobug2
  13848.  asr.l #3,d7
  13849.  add.l #1,d7
  13850.  bra.s .bug2
  13851. .nobug2
  13852.  asr.l #3,d7
  13853. .bug2: 
  13854.  
  13855.  add.l d6,PLR3s_xspdval
  13856.  add.l d7,PLR3s_zspdval
  13857.  
  13858. .nofriction:
  13859.  move.l PLR3s_xspdval,d6
  13860.  move.l PLR3s_zspdval,d7
  13861.  add.l d6,PLR3s_xoff
  13862.  add.l d7,PLR3s_zoff
  13863.  
  13864.  move.w PLR3s_angspd,d3
  13865.  tst.b SLOWDOWN
  13866.  beq.s .nofric
  13867.  asr.w #2,d3
  13868.  bge.s .nneg
  13869.  addq #1,d3
  13870. .nneg:
  13871. .nofric:
  13872.  
  13873.  move.w d3,PLR3s_angspd
  13874.  add.w d3,PLR3s_angpos
  13875.  add.w d3,PLR3s_angpos
  13876.  and.w #8190,PLR3s_angpos
  13877.  
  13878.  bra.s nocontrols
  13879.  
  13880. .propercontrol:
  13881.  tst.b PLR3MOUSE
  13882.  beq.s PLR3_nomouse
  13883.  bsr PLR3_mouse_control
  13884. PLR3_nomouse:
  13885.  tst.b PLR3KEYS
  13886.  beq.s PLR3_nokeys
  13887.  bsr PLR3_keyboard_control
  13888. PLR3_nokeys:
  13889. ; tst.b PLR2PATH
  13890. ; beq.s PLR2_nopath
  13891. ; bsr PLR1_follow_path
  13892. ;PLR2_nopath:
  13893.  tst.b PLR3JOY
  13894.  beq.s PLR3_nojoy
  13895.  bsr PLR3_JoyStick_control
  13896. PLR3_nojoy: 
  13897.  
  13898.  
  13899. nocontrols:
  13900.  
  13901.  move.l #$dff000,a6
  13902.  
  13903.  tst.b dosounds
  13904.  beq.s nomuckabout
  13905.  
  13906.  cmp.b #'4',Prefsfile+1
  13907.  bne.s nomuckabout
  13908.  
  13909.  move.w #$0,d0 
  13910.  tst.b NoiseMade0LEFT
  13911.  beq.s noturnoff0
  13912.  move.w #1,d0
  13913. noturnoff0:
  13914.  tst.b NoiseMade0RIGHT
  13915.  beq.s noturnoff1
  13916.  or.w #2,d0
  13917. noturnoff1:
  13918.  tst.b NoiseMade1RIGHT
  13919.  beq.s noturnoff2
  13920.  or.w #4,d0
  13921. noturnoff2:
  13922.  tst.b NoiseMade1LEFT
  13923.  beq.s noturnoff3
  13924.  or.w #8,d0
  13925. noturnoff3:
  13926.  
  13927. *********************
  13928.  and.w #$fffe,d0
  13929. *********************
  13930.  
  13931.     move.w d0,dmacon(a6)
  13932.  
  13933. nomuckabout:
  13934.  
  13935.  
  13936. ; tst.b PLR2_fire
  13937. ; beq.s firenotpressed2
  13938. ; fire was pressed last time.
  13939. ; btst #7,$bfe001
  13940. ; bne.s firenownotpressed2
  13941. ; fire is still pressed this time.
  13942. ; st PLR2_fire
  13943. ; bra dointer
  13944.  
  13945. firenownotpressed2:
  13946. ; fire has been released.
  13947. ; clr.b PLR2_fire
  13948. ; bra dointer
  13949.  
  13950. firenotpressed2
  13951.  
  13952. ; fire was not pressed last frame...
  13953.  
  13954. ; btst #7,$bfe001
  13955. ; if it has still not been pressed, go back above
  13956. ; bne.s firenownotpressed2
  13957. ; fire was not pressed last time, and was this time, so has
  13958. ; been clicked.
  13959. ; st PLR2_clicked
  13960. ; st PLR2_fire
  13961.  
  13962. dointer
  13963.  
  13964. JUSTSOUNDS:
  13965.  
  13966.  tst.b dosounds
  13967.  beq.s .notthing
  13968.  
  13969.  cmp.b #'4',Prefsfile+1
  13970.     beq fourchannel
  13971.  
  13972.  btst #1,$dff000+intreqr
  13973.     bne.s newsampbitl
  13974.  
  13975. .notthing:
  13976.  
  13977. ; move.w #$f,$dff000+dmacon
  13978.  
  13979.  movem.l (a7)+,d0-d7/a0-a6
  13980.  
  13981.  moveq #0,d0
  13982.  rts
  13983.  
  13984.  
  13985. dosounds: dc.w 0
  13986.  
  13987. swappedem: dc.w 0
  13988.  
  13989. newsampbitl:
  13990.  
  13991.  
  13992.  
  13993.  move.w #$200,$dff000+intreq
  13994.  
  13995.  tst.b CHANNELDATA
  13996.  bne nochannel0
  13997.  
  13998.  move.l pos0LEFT,a0
  13999.  move.l pos2LEFT,a1
  14000.  
  14001.  move.l #tab,a2
  14002.  
  14003.  moveq #0,d0
  14004.  moveq #0,d1
  14005.  move.b vol0left,d0
  14006.  move.b vol2left,d1
  14007.  cmp.b d1,d0
  14008.  slt swappedem
  14009.  bge.s fbig0
  14010.  
  14011. ; d1 is bigger so scale d0 and use d1
  14012. ; as audiochannel volume.
  14013.  
  14014.  exg a0,a1
  14015.  asl.w #6,d0
  14016.  divs d1,d0
  14017.  lsl.w #8,d0
  14018.  adda.w d0,a2
  14019.  move.w d1,$dff0a8
  14020.  bra.s donechan0
  14021.  
  14022. fbig0:
  14023.  tst.w d0
  14024.  beq.s donechan0
  14025.  asl.w #6,d1
  14026.  divs d0,d1
  14027.  lsl.w #8,d1
  14028.  adda.w d1,a2
  14029.  move.w d0,$dff0a8
  14030.  
  14031. donechan0:
  14032.  
  14033.  move.l Aupt0,a3
  14034.  move.l a3,$dff0a0
  14035.  move.l Auback0,Aupt0
  14036.  move.l a3,Auback0
  14037.  
  14038.  move.l Auback0,a3
  14039.  
  14040.  moveq #0,d0
  14041.  moveq #0,d1
  14042.  moveq #0,d2
  14043.  moveq #0,d3
  14044.  moveq #0,d4
  14045.  moveq #0,d5
  14046.  move.w #49,d7
  14047. loop:
  14048.  move.l (a0)+,d0
  14049.  move.b (a1)+,d1
  14050.  move.b (a1)+,d2
  14051.  move.b (a1)+,d3
  14052.  move.b (a1)+,d4
  14053.  move.b (a2,d3.w),d5
  14054.  swap d5
  14055.  move.b (a2,d1.w),d5
  14056.  asl.l #8,d5
  14057.  move.b (a2,d2.w),d5
  14058.  swap d5
  14059.  move.b (a2,d4.w),d5
  14060.  add.l d5,d0
  14061.  move.l d0,(a3)+
  14062.  dbra d7,loop
  14063.  
  14064.  tst.b swappedem
  14065.  beq.s .ok23
  14066.  exg a0,a1
  14067. .ok23:
  14068.  
  14069.  cmp.l Samp0endLEFT,a0
  14070.  blt.s .notoffendsamp1
  14071.  move.l #empty,a0
  14072.  move.l #emptyend,Samp0endLEFT
  14073.  move.b #0,vol0left
  14074.  clr.w LEFTCHANDATA+32
  14075.  move.w #0,LEFTCHANDATA+2
  14076. .notoffendsamp1:
  14077.  
  14078.  cmp.l Samp2endLEFT,a1
  14079.  blt.s .notoffendsamp2
  14080.  move.l #empty,a1
  14081.  move.l #emptyend,Samp2endLEFT
  14082.  move.b #0,vol2left
  14083.  clr.w LEFTCHANDATA+32+8
  14084.  move.w #0,LEFTCHANDATA+2+8
  14085. .notoffendsamp2:
  14086.  
  14087.  move.l a0,pos0LEFT
  14088.  move.l a1,pos2LEFT
  14089.  
  14090. nochannel0:
  14091.  
  14092.  tst.b CHANNELDATA+16
  14093.  bne nochannel1
  14094.  
  14095.  
  14096.  move.l pos0RIGHT,a0
  14097.  move.l pos2RIGHT,a1
  14098.  
  14099.  move.l Aupt1,a3
  14100.  move.l a3,$dff0b0
  14101.  move.l Auback1,Aupt1
  14102.  move.l a3,Auback1
  14103.  
  14104.  move.l #tab,a2
  14105.  
  14106.  moveq #0,d0
  14107.  moveq #0,d1
  14108.  move.b vol0right,d0
  14109.  move.b vol2right,d1
  14110.  cmp.b d1,d0
  14111.  slt swappedem
  14112.  bge.s fbig1
  14113.  
  14114. ; d1 is bigger so scale d0 and use d1
  14115. ; as audiochannel volume.
  14116.  
  14117.  exg a0,a1
  14118.  asl.w #6,d0
  14119.  divs d1,d0
  14120.  lsl.w #8,d0
  14121.  adda.w d0,a2
  14122.  move.w d1,$dff0b8
  14123.  bra.s donechan1
  14124.  
  14125. fbig1:
  14126.  tst.w d0
  14127.  beq.s donechan1
  14128.  asl.w #6,d1
  14129.  divs d0,d1
  14130.  lsl.w #8,d1
  14131.  adda.w d1,a2
  14132.  move.w d0,$dff0b8
  14133.  
  14134. donechan1:
  14135.  moveq #0,d0
  14136.  moveq #0,d1
  14137.  moveq #0,d2
  14138.  moveq #0,d3
  14139.  moveq #0,d4
  14140.  moveq #0,d5
  14141.  move.w #49,d7
  14142. loop2:
  14143.  move.l (a0)+,d0
  14144.  move.b (a1)+,d1
  14145.  move.b (a1)+,d2
  14146.  move.b (a1)+,d3
  14147.  move.b (a1)+,d4
  14148.  move.b (a2,d3.w),d5
  14149.  swap d5
  14150.  move.b (a2,d1.w),d5
  14151.  asl.l #8,d5
  14152.  move.b (a2,d2.w),d5
  14153.  swap d5
  14154.  move.b (a2,d4.w),d5
  14155.  add.l d5,d0
  14156.  move.l d0,(a3)+
  14157.  dbra d7,loop2
  14158.  
  14159.  tst.b swappedem
  14160.  beq.s ok01
  14161.  exg a0,a1
  14162. ok01:
  14163.  
  14164.  cmp.l Samp0endRIGHT,a0
  14165.  blt.s .notoffendsamp1
  14166.  move.l #empty,a0
  14167.  move.l #emptyend,Samp0endRIGHT
  14168.  move.b #0,vol0right
  14169.  clr.w RIGHTCHANDATA+32
  14170.  move.w #0,RIGHTCHANDATA+2
  14171. .notoffendsamp1:
  14172.  
  14173.  cmp.l Samp2endRIGHT,a1
  14174.  blt.s .notoffendsamp2
  14175.  move.l #empty,a1
  14176.  move.l #emptyend,Samp2endRIGHT
  14177.  move.b #0,vol2right
  14178.  clr.w RIGHTCHANDATA+32+8
  14179.  move.w #0,RIGHTCHANDATA+2+8
  14180. .notoffendsamp2:
  14181.  
  14182.  move.l a0,pos0RIGHT
  14183.  move.l a1,pos2RIGHT
  14184.  
  14185. nochannel1:
  14186.  
  14187. ******************* Other two channels
  14188.  
  14189.  move.l pos1LEFT,a0
  14190.  move.l pos3LEFT,a1
  14191.  
  14192.  move.l #tab,a2
  14193.  
  14194.  moveq #0,d0
  14195.  moveq #0,d1
  14196.  move.b vol1left,d0
  14197.  move.b vol3left,d1
  14198.  cmp.b d1,d0
  14199.  slt swappedem
  14200.  bge.s fbig2
  14201.  
  14202. ; d1 is bigger so scale d0 and use d1
  14203. ; as audiochannel volume.
  14204.  
  14205.  exg a0,a1
  14206.  asl.w #6,d0
  14207.  divs d1,d0
  14208.  lsl.w #8,d0
  14209.  adda.w d0,a2
  14210.  move.w d1,$dff0d8
  14211.  bra.s donechan2
  14212.  
  14213. fbig2:
  14214.  tst.w d0
  14215.  beq.s donechan2
  14216.  asl.w #6,d1
  14217.  divs d0,d1
  14218.  lsl.w #8,d1
  14219.  adda.w d1,a2
  14220.  move.w d0,$dff0d8
  14221.  
  14222. donechan2:
  14223.  
  14224.  move.l Aupt2,a3
  14225.  move.l a3,$dff0d0
  14226.  move.l Auback2,Aupt2
  14227.  move.l a3,Auback2
  14228.  
  14229.  moveq #0,d0
  14230.  moveq #0,d1
  14231.  moveq #0,d2
  14232.  moveq #0,d3
  14233.  moveq #0,d4
  14234.  moveq #0,d5
  14235.  move.w #49,d7
  14236. loop3:
  14237.  move.l (a0)+,d0
  14238.  move.b (a1)+,d1
  14239.  move.b (a1)+,d2
  14240.  move.b (a1)+,d3
  14241.  move.b (a1)+,d4
  14242.  move.b (a2,d3.w),d5
  14243.  swap d5
  14244.  move.b (a2,d1.w),d5
  14245.  asl.l #8,d5
  14246.  move.b (a2,d2.w),d5
  14247.  swap d5
  14248.  move.b (a2,d4.w),d5
  14249.  add.l d5,d0
  14250.  move.l d0,(a3)+
  14251.  dbra d7,loop3
  14252.  
  14253.  tst.b swappedem
  14254.  beq.s .ok23
  14255.  exg a0,a1
  14256. .ok23:
  14257.  
  14258.  cmp.l Samp1endLEFT,a0
  14259.  blt.s .notoffendsamp3
  14260.  move.l #empty,a0
  14261.  move.l #emptyend,Samp1endLEFT
  14262.  move.b #0,vol1left
  14263.  clr.w LEFTCHANDATA+32+4
  14264.  move.w #0,LEFTCHANDATA+2+4
  14265. .notoffendsamp3:
  14266.  
  14267.  cmp.l Samp3endLEFT,a1
  14268.  blt.s .notoffendsamp4
  14269.  move.l #empty,a1
  14270.  move.l #emptyend,Samp3endLEFT
  14271.  move.b #0,vol3left
  14272.  clr.w LEFTCHANDATA+32+12
  14273.  move.w #0,LEFTCHANDATA+2+12
  14274. .notoffendsamp4:
  14275.  
  14276.  move.l a0,pos1LEFT
  14277.  move.l a1,pos3LEFT
  14278.  
  14279.  move.l pos1RIGHT,a0
  14280.  move.l pos3RIGHT,a1
  14281.  
  14282.  move.l Aupt3,a3
  14283.  move.l a3,$dff0c0
  14284.  move.l Auback3,Aupt3
  14285.  move.l a3,Auback3
  14286.  
  14287.  move.l #tab,a2
  14288.  
  14289.  moveq #0,d0
  14290.  moveq #0,d1
  14291.  move.b vol1right,d0
  14292.  move.b vol3right,d1
  14293.  cmp.b d1,d0
  14294.  slt.s swappedem
  14295.  bge.s fbig3
  14296.  
  14297.  exg a0,a1
  14298.  asl.w #6,d0
  14299.  divs d1,d0
  14300.  lsl.w #8,d0
  14301.  adda.w d0,a2
  14302.  move.w d1,$dff0c8
  14303.  bra.s donechan3
  14304.  
  14305. fbig3:
  14306.  tst.w d0
  14307.  beq.s donechan3
  14308.  asl.w #6,d1
  14309.  divs d0,d1
  14310.  lsl.w #8,d1
  14311.  adda.w d1,a2
  14312.  move.w d0,$dff0c8
  14313. donechan3:
  14314.  
  14315.  moveq #0,d0
  14316.  moveq #0,d1
  14317.  moveq #0,d2
  14318.  moveq #0,d3
  14319.  moveq #0,d4
  14320.  moveq #0,d5
  14321.  move.w #49,d7
  14322. loop4:
  14323.  move.l (a0)+,d0
  14324.  move.b (a1)+,d1
  14325.  move.b (a1)+,d2
  14326.  move.b (a1)+,d3
  14327.  move.b (a1)+,d4
  14328.  move.b (a2,d3.w),d5
  14329.  swap d5
  14330.  move.b (a2,d1.w),d5
  14331.  asl.l #8,d5
  14332.  move.b (a2,d2.w),d5
  14333.  swap d5
  14334.  move.b (a2,d4.w),d5
  14335.  add.l d5,d0
  14336.  move.l d0,(a3)+
  14337.  dbra d7,loop4
  14338.  
  14339.  tst.b swappedem
  14340.  beq.s .ok23
  14341.  exg a0,a1
  14342. .ok23:
  14343.  
  14344.  cmp.l Samp1endRIGHT,a0
  14345.  blt.s notoffendsamp3
  14346.  move.l #empty,a0
  14347.  move.l #emptyend,Samp1endRIGHT
  14348.  move.b #0,vol1right
  14349.  clr.w RIGHTCHANDATA+32+4
  14350.  move.w #0,RIGHTCHANDATA+2+4
  14351. notoffendsamp3:
  14352.  
  14353.  cmp.l Samp3endRIGHT,a1
  14354.  blt.s notoffendsamp4
  14355.  move.l #empty,a1
  14356.  move.l #emptyend,Samp3endRIGHT
  14357.  move.b #0,vol3right
  14358.  clr.w RIGHTCHANDATA+32+12
  14359.  move.w #0,RIGHTCHANDATA+2+12
  14360. notoffendsamp4:
  14361.  
  14362.  move.l a0,pos1RIGHT
  14363.  move.l a1,pos3RIGHT
  14364.  
  14365.  movem.l (a7)+,d0-d7/a0-a6
  14366. ; tst.b counting
  14367. ; beq .nostartcounter
  14368. ; JSR STARTCOUNT
  14369. ;.nostartcounter:
  14370.  
  14371.  move.w #$820f,$dff000+dmacon
  14372.  
  14373.  moveq #0,d0
  14374.  rts
  14375.  
  14376. ***********************************
  14377. * 4 channel sound routine
  14378. ***********************************
  14379.  
  14380. fourchannel:
  14381.  
  14382.  move.l #$dff000,a6
  14383.  
  14384.  tst.b LEFTCHANDATA
  14385.  bne.s NoChan0sound
  14386.  
  14387.  btst #7,intreqrl(a6)
  14388.  beq.s nofinish0
  14389. ; move.w #0,LEFTCHANDATA+2
  14390. ; st LEFTCHANDATA+1
  14391.  move.l #null,$a0(a6)
  14392.  move.w #100,$a4(a6) 
  14393.  move.w #$0080,intreq(a6)
  14394. nofinish0:
  14395.  
  14396.  tst.b NoiseMade0pLEFT
  14397.  beq.s NoChan0sound
  14398.  
  14399.  move.l Samp0endLEFT,d0
  14400.  move.l pos0LEFT,d1
  14401.  sub.l d1,d0
  14402.  lsr.l #1,d0
  14403.  move.w d0,$a4(a6)
  14404.  move.l d1,$a0(a6)
  14405.  ext.l d0
  14406.  divs #100,d0
  14407.  move.w d0,playnull0
  14408.  move.w #$8201,dmacon(a6)
  14409.  moveq #0,d0
  14410.  move.b vol0left,d0
  14411.  move.w d0,$a8(a6)
  14412.  
  14413. NoChan0sound:
  14414.  
  14415. *****************************************
  14416. *****************************************
  14417.  
  14418.  btst #0,intreqr(a6)
  14419.  beq.s nofinish1
  14420.  move.l #null,$b0(a6)
  14421.  move.w #100,$b4(a6)
  14422.  move.w #$0100,intreq(a6)
  14423. nofinish1:
  14424.  
  14425.  tst.b NoiseMade0pRIGHT
  14426.  beq.s NoChan1sound
  14427.  
  14428.  move.l Samp0endRIGHT,d0
  14429.  move.l pos0RIGHT,d1
  14430.  sub.l d1,d0
  14431.  lsr.l #1,d0
  14432.  move.w d0,$b4(a6)
  14433.  move.l d1,$b0(a6)
  14434.  ext.l d0
  14435.  divs #100,d0
  14436.  move.w d0,playnull1
  14437.  move.w #$8202,dmacon(a6)
  14438.  moveq #0,d0
  14439.  move.b vol0right,d0
  14440.  move.w d0,$b8(a6)
  14441.  
  14442. NoChan1sound:
  14443.  
  14444. *****************************************
  14445. *****************************************
  14446.  
  14447.  btst #1,intreqr(a6)
  14448.  beq.s nofinish2
  14449.  move.l #null,$c0(a6)
  14450.  move.w #100,$c4(a6)
  14451.  move.w #$0200,intreq(a6)
  14452. nofinish2:
  14453.  
  14454.  tst.b NoiseMade1pRIGHT
  14455.  beq.s NoChan2sound
  14456.  
  14457.  move.l Samp1endRIGHT,d0
  14458.  move.l pos1RIGHT,d1
  14459.  sub.l d1,d0
  14460.  lsr.l #1,d0
  14461.  move.w d0,$c4(a6)
  14462.  ext.l d0
  14463.  divs #100,d0
  14464.  move.w d0,playnull2
  14465.  
  14466.  move.l d1,$c0(a6)
  14467.  move.w #$8204,dmacon(a6)
  14468.  moveq #0,d0
  14469.  move.b vol1right,d0
  14470.  move.w d0,$c8(a6)
  14471.  
  14472. NoChan2sound:
  14473.  
  14474. *****************************************
  14475. *****************************************
  14476.  
  14477.  btst #2,intreqr(a6)
  14478.  beq.s nofinish3
  14479.  move.l #null,$d0(a6)
  14480.  move.w #100,$d4(a6)
  14481.  move.w #$0400,intreq(a6)
  14482. nofinish3:
  14483.  
  14484.  tst.b NoiseMade1pLEFT
  14485.  beq.s NoChan3sound
  14486.  
  14487.  move.l Samp1endLEFT,d0
  14488.  move.l pos1LEFT,d1
  14489.  sub.l d1,d0
  14490.  lsr.l #1,d0
  14491.  move.w d0,$d4(a6)
  14492.  ext.l d0
  14493.  divs #100,d0
  14494.  move.w d0,playnull3
  14495.  move.l d1,$d0(a6)
  14496.  move.w #$8208,dmacon(a6)
  14497.  moveq #0,d0
  14498.  move.b vol1left,d0
  14499.  move.w d0,$d8(a6)
  14500.  
  14501. NoChan3sound:
  14502.  
  14503. nomorechannels:
  14504.  
  14505.  move.l NoiseMade0LEFT,NoiseMade0pLEFT
  14506.  move.l #0,NoiseMade0LEFT
  14507.  move.l NoiseMade0RIGHT,NoiseMade0pRIGHT
  14508.  move.l #0,NoiseMade0RIGHT
  14509.  
  14510. ; tst.b playnull0
  14511. ; beq.s .nnul
  14512. ; sub.b #1,playnull0
  14513. ; bra.s chan0still
  14514. ;.nnul:
  14515. ;chan0still:
  14516.  
  14517.  tst.b NoiseMade0pLEFT
  14518.  bne.s chan0still
  14519.  tst.w playnull0
  14520.  beq.s nnul0
  14521.  sub.w #1,playnull0
  14522.  bra.s chan0still
  14523. nnul0:
  14524.  move.w #0,LEFTCHANDATA+2
  14525.  clr.w LEFTCHANDATA+32
  14526. chan0still:
  14527.  
  14528.  tst.b NoiseMade0pRIGHT
  14529.  bne.s chan1still    ;it'll never work
  14530.  tst.w playnull1
  14531.  beq.s nnul1
  14532.  sub.w #1,playnull1
  14533.  bra.s chan1still
  14534. nnul1:
  14535.  move.w #0,RIGHTCHANDATA+2
  14536.  clr.w RIGHTCHANDATA+32
  14537. chan1still:
  14538.  
  14539.  tst.b NoiseMade1pRIGHT
  14540.  bne.s chan2still
  14541.  tst.w playnull2
  14542.  beq.s nnul2
  14543.  sub.w #1,playnull2
  14544.  bra.s chan2still
  14545. nnul2:
  14546.  move.w #0,RIGHTCHANDATA+2+4
  14547.  clr.w RIGHTCHANDATA+32+4
  14548. chan2still:
  14549.  
  14550.  tst.b NoiseMade1pLEFT
  14551.  bne.s chan3still
  14552.  tst.w playnull3
  14553.  beq.s nnul3
  14554.  sub.w #1,playnull3
  14555.  bra.s chan3still
  14556. nnul3:
  14557.  move.w #0,LEFTCHANDATA+2+4
  14558.  clr.w LEFTCHANDATA+32+4
  14559.  
  14560. chan3still:
  14561.  
  14562.  
  14563.  movem.l (a7)+,d0-d7/a0-a6
  14564.  
  14565.  moveq #0,d0
  14566.  rts
  14567.  
  14568. backbeat: dc.w 0
  14569.  
  14570. playnull0: dc.w 0
  14571. playnull1: dc.w 0
  14572. playnull2: dc.w 0
  14573. playnull3: dc.w 0
  14574.  
  14575. Samp0endRIGHT: dc.l emptyend
  14576. Samp1endRIGHT: dc.l emptyend
  14577. Samp2endRIGHT: dc.l emptyend
  14578. Samp3endRIGHT: dc.l emptyend
  14579. Samp0endLEFT: dc.l emptyend
  14580. Samp1endLEFT: dc.l emptyend
  14581. Samp2endLEFT: dc.l emptyend
  14582. Samp3endLEFT: dc.l emptyend
  14583.  
  14584. Aupt0: dc.l null
  14585. Auback0: dc.l null+500
  14586. Aupt2: dc.l null3
  14587. Auback2: dc.l null3+500
  14588. Aupt3: dc.l null4
  14589. Auback3: dc.l null4+500
  14590. Aupt1: dc.l null2
  14591. Auback1: dc.l null2+500
  14592.  
  14593. NoiseMade0LEFT: dc.b 0
  14594. NoiseMade1LEFT: dc.b 0
  14595. NoiseMade2LEFT: dc.b 0
  14596. NoiseMade3LEFT: dc.b 0
  14597. NoiseMade0pLEFT: dc.b 0
  14598. NoiseMade1pLEFT: dc.b 0
  14599. NoiseMade2pLEFT: dc.b 0
  14600. NoiseMade3pLEFT: dc.b 0
  14601. NoiseMade0RIGHT: dc.b 0
  14602. NoiseMade1RIGHT: dc.b 0
  14603. NoiseMade2RIGHT: dc.b 0
  14604. NoiseMade3RIGHT: dc.b 0
  14605. NoiseMade0pRIGHT: dc.b 0
  14606. NoiseMade1pRIGHT: dc.b 0
  14607. NoiseMade2pRIGHT: dc.b 0
  14608. NoiseMade3pRIGHT: dc.b 0
  14609.  
  14610. empty: ds.l 100
  14611. emptyend:
  14612.  
  14613. **************************************
  14614. * I want a routine to calculate all the
  14615. * info needed for the sound player to
  14616. * work, given say position of noise, volume
  14617. * and sample number.
  14618.  
  14619. Samplenum: dc.w 0
  14620. Noisex: dc.w 0
  14621. Noisez: dc.w 0
  14622. Noisevol: dc.w 0
  14623. chanpick: dc.w 0
  14624. IDNUM: dc.w 0
  14625. needleft: dc.b 0
  14626. needright: dc.b 0
  14627. STEREO: dc.b $0
  14628. even
  14629. prot6: dc.w 0
  14630.  
  14631.  even
  14632. CHANNELDATA:
  14633. LEFTCHANDATA:
  14634.  dc.l $00000000
  14635.  dc.l $00000000
  14636.  dc.l $FF000000
  14637.  dc.l $FF000000
  14638. RIGHTCHANDATA:
  14639.  dc.l $00000000
  14640.  dc.l $00000000
  14641.  dc.l $FF000000
  14642.  dc.l $FF000000
  14643.  
  14644.  ds.l 8
  14645.  
  14646. RIGHTPLAYEDTAB: ds.l 20
  14647. LEFTPLAYEDTAB: ds.l 20
  14648.  
  14649. SourceEcho: dc.w 0
  14650. PLREcho: dc.w 0
  14651.  
  14652.  
  14653. LEFTOFFSET: dc.l 0
  14654. RIGHTOFFSET: dc.l 0
  14655.  
  14656. MakeSomeNoise:
  14657.  
  14658. ; move.w #$10,$dff000+intena
  14659.  
  14660. ; Plan for new sound handler:
  14661. ; It is sent a sample number,
  14662. ; a position relative to the
  14663. ; player, an id number and a volume.
  14664. ; Also notifplaying.
  14665.     
  14666. ; indirect inputs are the available
  14667. ; channel flags and whether or not
  14668. ; stereo sound is selected.
  14669.  
  14670. ; the algorithm must decide
  14671. ; whether the new sound is more
  14672. ; important than the ones already
  14673. ; playing. Thus an 'importance'
  14674. ; must be calculated, probably
  14675. ; using volume.
  14676.  
  14677. ; The output needs to be:
  14678.  
  14679. ; Write the pointers and volumes of
  14680. ; the sound channels
  14681.  
  14682.  tst.b notifplaying
  14683.  beq.s dontworry
  14684.  
  14685. ; find if we are already playing
  14686.  
  14687.  move.w IDNUM,d0
  14688.  cmp.w #$ffff,d0
  14689.  beq.s dontworry
  14690.  move.w #7,d1
  14691.  lea CHANNELDATA,a3
  14692. findsameasme
  14693.  tst.b (a3)
  14694.  bne.s notavail
  14695.  cmp.w 32(a3),d0
  14696.  beq SameAsMe
  14697. notavail:
  14698.  add.w #4,a3
  14699.  dbra d1,findsameasme
  14700.  bra dontworry
  14701. SameAsMe
  14702. ; move.w #$8010,$dff000+intena
  14703.  rts
  14704.  
  14705. noiseloud: dc.w 0
  14706.  
  14707. dontworry:
  14708.  
  14709. ; Ok its fine for us to play a sound.
  14710. ; So calculate left/right volume.
  14711.  
  14712.  move.w Noisex,d1
  14713.  muls d1,d1
  14714.  move.w Noisez,d2
  14715.  muls d2,d2
  14716.  move.w Noisevol,d3
  14717.  move.w #32767,noiseloud
  14718.  moveq #1,d0
  14719.  add.l d1,d2
  14720.  beq pastcalc
  14721.  
  14722.  move.w #31,d0
  14723. .findhigh
  14724.  btst d0,d2
  14725.  bne .foundhigh
  14726.  dbra d0,.findhigh
  14727. .foundhigh
  14728.  asr.w #1,d0
  14729.  clr.l d3
  14730.  bset d0,d3
  14731.  move.l d3,d0
  14732.  
  14733.  move.w d0,d3
  14734.  muls d3,d3    ; x*x
  14735.  sub.l d2,d3    ; x*x-a
  14736.  asr.l #1,d3    ; (x*x-a)/2
  14737.  divs d0,d3    ; (x*x-a)/2x
  14738.  sub.w d3,d0    ; second approx
  14739.  bgt .stillnot0
  14740.  move.w #1,d0
  14741. .stillnot0
  14742.  
  14743.  move.w d0,d3
  14744.  muls d3,d3
  14745.  sub.l d2,d3
  14746.  asr.l #1,d3
  14747.  divs d0,d3
  14748.  sub.w d3,d0    ; second approx
  14749.  bgt .stillnot02
  14750.  move.w #1,d0
  14751. .stillnot02
  14752.  
  14753.  move.w Noisevol,d3
  14754.  ext.l d3
  14755.  asl.l #6,d3
  14756.  cmp.l #32767,d3
  14757.  ble.s .nnnn
  14758.  move.l #32767,d3
  14759. .nnnn
  14760.  
  14761.  asr.w #2,d0
  14762.  addq #1,d0
  14763.  divs d0,d3
  14764.  
  14765. pastcalc:
  14766.  move.w d3,noiseloud
  14767.  
  14768.  cmp.w #64,d3
  14769.  ble.s notooloud
  14770.  move.w #64,d3
  14771. notooloud:
  14772.  
  14773.     ; d3 contains volume of noise.
  14774.     
  14775.  move.w d3,d4
  14776.  tst.b STEREO
  14777.  beq NOSTEREO
  14778.  
  14779.  move.w d3,d2
  14780.  muls Noisex,d2
  14781.  asl.w #2,d0
  14782.  divs d0,d2
  14783.  
  14784.  bgt.s quietleft
  14785.  add.w d2,d4
  14786.  bge.s donequiet
  14787.  move.w #0,d4
  14788.  bra.s donequiet
  14789. quietleft:
  14790.  sub.w d2,d3
  14791.  bge.s donequiet
  14792.  move.w #0,d3
  14793. donequiet:
  14794.  
  14795. ; d3=leftvol?
  14796. ; d4=rightvol?
  14797.  
  14798.  
  14799.     ; d3 contains volume of noise.
  14800.     
  14801.  move.w #$ffff,needleft
  14802.  
  14803.  move.l #0,RIGHTOFFSET
  14804.  move.l #0,LEFTOFFSET
  14805.  
  14806.  cmp.b d3,d4
  14807.  bgt.s RightLouder
  14808.  beq.s NoLouder
  14809.  
  14810.  move.l #4,LEFTOFFSET
  14811.  
  14812. ; Left is louder; is it MUCH louder?
  14813.  
  14814.  st needleft
  14815.  move.w d3,d2
  14816.  sub.w d4,d2
  14817.  cmp.w #32,d2
  14818.  slt needright
  14819.  bra aboutsame
  14820.  
  14821. RightLouder:
  14822.  move.l #4,RIGHTOFFSET
  14823.  st needright
  14824.  move.w d4,d2
  14825.  sub.w d3,d2
  14826.  cmp.w #32,d2
  14827.  slt needleft
  14828.  
  14829. aboutsame:
  14830. NoLouder:
  14831.  
  14832.  
  14833. ; Find least important sound on left
  14834.  
  14835.  move.l #0,a2
  14836.  move.l #0,d5
  14837.  move.w #32767,d2
  14838.  move.w IDNUM,d0
  14839.  lea LEFTCHANDATA,a3
  14840.  move.w #3,d1
  14841. FindLeftChannel
  14842.  tst.b (a3)
  14843.  bne.s .notactive
  14844.  cmp.w 32(a3),d0
  14845.  beq.s FOUNDLEFT
  14846.  cmp.w 2(a3),d2
  14847.  blt.s .notactive
  14848.  move.w 2(a3),d2
  14849.  move.l a3,a2
  14850.  move.w d5,d6
  14851.  
  14852. .notactive:
  14853.  add.w #4,a3
  14854.  add.w #1,d5
  14855.  dbra d1,FindLeftChannel
  14856.  move.l a2,a3
  14857.  bra.s gopastleft
  14858. FOUNDLEFT:
  14859.  move.w d5,d6
  14860. gopastleft:
  14861.  move.l a3,d5
  14862.  tst.l d5
  14863.  bne.s FOUNDALEFT
  14864. NONOISE:
  14865. ; move.w #$8010,$dff000+intena
  14866.  rts
  14867. FOUNDALEFT:
  14868.  
  14869.  cmp.w noiseloud,d2
  14870.  bge dorightchan
  14871.  
  14872. ; d6 = channel number
  14873.  cmp.w #$ffff,d0
  14874.  bne.s .noche
  14875.  move.w #$fffe,d0
  14876. .noche:
  14877.  move.w d0,32(a3)
  14878.  move.w noiseloud,2(a3)
  14879.  
  14880.  move.w Samplenum,d5
  14881.  
  14882. ; tst.b Echo
  14883. ; bne.s YESECHO
  14884. ; tst.b SourceEcho
  14885. ; beq.s NOECHO
  14886. ;
  14887. ;YESECHO:
  14888. ;
  14889. ; move.l LINKFILE,a3
  14890. ; add.l #EchoTable,a3
  14891. ; move.b (a3,d5.w),d5
  14892. ;
  14893. ;NOECHO:
  14894.  
  14895.  move.l #SampleList,a3
  14896.  move.l (a3,d5.w*8),a1
  14897.  add.l LEFTOFFSET,a1
  14898.  move.l 4(a3,d5.w*8),a2
  14899.  add.l LEFTOFFSET,a2
  14900.  
  14901.  tst.b d6
  14902.  seq NoiseMade0LEFT
  14903.  beq.s .chan0
  14904.  cmp.b #2,d6
  14905.  slt NoiseMade1LEFT
  14906.  blt .chan1
  14907.  seq NoiseMade2LEFT
  14908.  beq .chan2
  14909.  st NoiseMade3LEFT
  14910.  
  14911.  move.b d5,LEFTPLAYEDTAB+9
  14912.  move.b d3,LEFTPLAYEDTAB+1+9
  14913.  move.b d4,LEFTPLAYEDTAB+2+9
  14914.  move.b d3,vol3left
  14915.  move.l a1,pos3LEFT
  14916.  move.l a2,Samp3endLEFT
  14917.  bra dorightchan
  14918.  
  14919. .chan0: 
  14920.  move.b d5,LEFTPLAYEDTAB
  14921.  move.b d3,LEFTPLAYEDTAB+1
  14922.  move.b d4,LEFTPLAYEDTAB+2
  14923.  move.l a1,pos0LEFT
  14924.  move.l a2,Samp0endLEFT
  14925.  move.b d3,vol0left
  14926.  bra dorightchan
  14927.  
  14928. .chan1:
  14929.  move.b d5,LEFTPLAYEDTAB+3
  14930.  move.b d3,LEFTPLAYEDTAB+1+3
  14931.  move.b d4,LEFTPLAYEDTAB+2+3
  14932.  move.b d3,vol1left
  14933.  move.l a1,pos1LEFT
  14934.  move.l a2,Samp1endLEFT
  14935.  bra dorightchan
  14936.  
  14937. .chan2: 
  14938.  move.b d5,LEFTPLAYEDTAB+6
  14939.  move.b d3,LEFTPLAYEDTAB+1+6
  14940.  move.b d4,LEFTPLAYEDTAB+2+6
  14941.  move.l a1,pos2LEFT
  14942.  move.l a2,Samp2endLEFT
  14943.  move.b d3,vol2left
  14944.  
  14945. dorightchan:
  14946.  
  14947. ; Find least important sound on right
  14948.  
  14949.  move.l #0,a2
  14950.  move.l #0,d5
  14951.  move.w #10000,d2
  14952.  move.w IDNUM,d0
  14953.  lea RIGHTCHANDATA,a3
  14954.  move.w #3,d1
  14955. FindRightChannel
  14956.  tst.b (a3)
  14957.  bne.s .notactive
  14958.  cmp.w 32(a3),d0
  14959.  beq.s FOUNDRIGHT
  14960.  cmp.w 2(a3),d2
  14961.  blt.s .notactive
  14962.  move.w 2(a3),d2
  14963.  move.l a3,a2
  14964.  move.w d5,d6
  14965.  
  14966. .notactive:
  14967.  add.w #4,a3
  14968.  add.w #1,d5
  14969.  dbra d1,FindRightChannel
  14970.  move.l a2,a3
  14971.  bra.s gopastright
  14972. FOUNDRIGHT:
  14973.  move.w d5,d6
  14974. gopastright:
  14975.  move.l a3,d5
  14976.  tst.l d5
  14977.  bne.s FOUNDARIGHT
  14978. tototot:
  14979. ; move.w #$8010,$dff000+intena
  14980.  rts
  14981. FOUNDARIGHT:
  14982.  
  14983.  cmp.w noiseloud,d2
  14984.  bgt.s tototot
  14985.  
  14986. ; d6 = channel number
  14987.  cmp.w #$ffff,d0
  14988.  bne.s .noche
  14989.  move.w #$fffe,d0
  14990. .noche:
  14991.  move.w d0,32(a3)
  14992.  move.w noiseloud,2(a3)
  14993.  
  14994.  move.w Samplenum,d5
  14995.  move.l #SampleList,a3
  14996.  move.l (a3,d5.w*8),a1
  14997.  move.l 4(a3,d5.w*8),a2
  14998.  add.l RIGHTOFFSET,a1
  14999.  add.l RIGHTOFFSET,a2
  15000.  
  15001.  tst.b d6
  15002.  seq NoiseMade0RIGHT
  15003.  beq.s .chan0
  15004.  cmp.b #2,d6
  15005.  slt NoiseMade1RIGHT
  15006.  blt .chan1
  15007.  seq NoiseMade2RIGHT
  15008.  beq .chan2
  15009.  st NoiseMade3RIGHT
  15010.  
  15011.  move.b d5,RIGHTPLAYEDTAB+9
  15012.  move.b d3,RIGHTPLAYEDTAB+1+9
  15013.  move.b d4,RIGHTPLAYEDTAB+2+9
  15014.  move.b d4,vol3right
  15015.  move.l a1,pos3RIGHT
  15016.  move.l a2,Samp3endRIGHT
  15017. ; move.w #$8010,$dff000+intena
  15018.  rts
  15019.  
  15020. .chan0: 
  15021.  move.b d5,RIGHTPLAYEDTAB
  15022.  move.b d3,RIGHTPLAYEDTAB+1
  15023.  move.b d4,RIGHTPLAYEDTAB+2
  15024.  move.l a1,pos0RIGHT
  15025.  move.l a2,Samp0endRIGHT
  15026.  move.b d4,vol0right
  15027. ; move.w #$8010,$dff000+intena
  15028.  rts
  15029.  
  15030. .chan1:
  15031.  move.b d5,RIGHTPLAYEDTAB+3
  15032.  move.b d3,RIGHTPLAYEDTAB+1+3
  15033.  move.b d4,RIGHTPLAYEDTAB+2+3
  15034.  move.b d3,vol1right
  15035.  move.l a1,pos1RIGHT
  15036.  move.l a2,Samp1endRIGHT
  15037. ; move.w #$8010,$dff000+intena
  15038.  rts
  15039.  
  15040. .chan2: 
  15041.  move.b d5,RIGHTPLAYEDTAB+6
  15042.  move.b d3,RIGHTPLAYEDTAB+1+6
  15043.  move.b d4,RIGHTPLAYEDTAB+2+6
  15044.  move.l a1,pos2RIGHT
  15045.  move.l a2,Samp2endRIGHT
  15046.  move.b d3,vol2right
  15047. ; move.w #$8010,$dff000+intena
  15048.  rts
  15049.  
  15050. NOSTEREO:
  15051.  move.l #0,a2
  15052.  move.l #-1,d5
  15053.  move.w #32767,d2
  15054.  move.w IDNUM,d0
  15055.  lea CHANNELDATA,a3
  15056.  move.w #7,d1
  15057.  moveq #-1,d6
  15058.  
  15059. FindChannel
  15060.  tst.b (a3)
  15061.  bne.s .notactive
  15062.  cmp.w 32(a3),d0
  15063.  beq.s FOUNDMYCHAN
  15064.  cmp.w 2(a3),d2
  15065.  blt.s .notactive
  15066.  move.w 2(a3),d2
  15067.  move.l a3,a2
  15068.  move.w d5,d6
  15069.  add.w #1,d6
  15070.  
  15071. .notactive:
  15072.  add.w #4,a3
  15073.  add.w #1,d5
  15074.  dbra d1,FindChannel
  15075.  
  15076.  move.l a2,a3
  15077.  bra.s gopastchan
  15078.  
  15079. FOUNDMYCHAN:
  15080.  move.w 2(a3),d2
  15081.  
  15082. FOUNDCHAN:
  15083.  move.w d5,d6
  15084.  add.w #1,d6
  15085. gopastchan:
  15086.  tst.w d6
  15087.  bge.s FOUNDACHAN
  15088. tooquiet:
  15089. ; move.w #$8010,$dff000+intena
  15090.  rts
  15091. FOUNDACHAN:
  15092.  
  15093. ; d6 = channel number
  15094.  
  15095.  cmp.w noiseloud,d2
  15096.  bgt.s tooquiet
  15097.  
  15098.  cmp.w #$ffff,d0
  15099.  bne.s .noche
  15100.  move.w #$fffe,d0
  15101. .noche:
  15102.  move.w d0,32(a3)
  15103.  move.w noiseloud,2(a3)
  15104.  
  15105.  move.w Samplenum,d5
  15106.  
  15107. ; tst.b Echo
  15108. ; bne.s YESECHO2
  15109. ; tst.b SourceEcho
  15110. ; beq.s NOECHO2
  15111. ;
  15112. ;YESECHO2:
  15113. ;
  15114. ; move.l LINKFILE,a3
  15115. ; add.l #EchoTable,a3
  15116. ; move.b (a3,d5.w),d5
  15117. ;
  15118. ;NOECHO2:
  15119.  
  15120.  move.l #SampleList,a3
  15121.  move.l (a3,d5.w*8),a1
  15122.  move.l 4(a3,d5.w*8),a2
  15123.  
  15124.  tst.b d6
  15125.  beq .chan0
  15126.  cmp.b #2,d6
  15127.  blt .chan1
  15128.  beq .chan2
  15129.  cmp.b #4,d6
  15130.  blt .chan3
  15131.  beq .chan4
  15132.  cmp.b #6,d6
  15133.  blt .chan5
  15134.  beq .chan6
  15135.  st NoiseMade3RIGHT
  15136.  
  15137.  move.b d5,RIGHTPLAYEDTAB+9
  15138.  move.b d3,RIGHTPLAYEDTAB+1+9
  15139.  move.b d4,RIGHTPLAYEDTAB+2+9
  15140.  move.b d4,vol3right
  15141.  move.l a1,pos3RIGHT
  15142.  move.l a2,Samp3endRIGHT
  15143. ; move.w #$8010,$dff000+intena
  15144.  rts
  15145.  
  15146. .chan3:
  15147.  st NoiseMade3LEFT
  15148.  move.b d5,LEFTPLAYEDTAB+9
  15149.  move.b d3,LEFTPLAYEDTAB+1+9
  15150.  move.b d4,LEFTPLAYEDTAB+2+9
  15151.  move.b d3,vol3left
  15152.  move.l a1,pos3LEFT
  15153.  move.l a2,Samp3endLEFT
  15154. ; move.w #$8010,$dff000+intena
  15155.  rts
  15156.  
  15157. .chan0: 
  15158.  st NoiseMade0LEFT
  15159.  move.b d5,LEFTPLAYEDTAB
  15160.  move.b d3,LEFTPLAYEDTAB+1
  15161.  move.b d4,LEFTPLAYEDTAB+2
  15162.  move.l a1,pos0LEFT
  15163.  move.l a2,Samp0endLEFT
  15164.  move.b d3,vol0left
  15165. ; move.w #$8010,$dff000+intena
  15166.  rts
  15167.  
  15168. .chan1:
  15169.  st NoiseMade1LEFT
  15170.  move.b d5,LEFTPLAYEDTAB+3
  15171.  move.b d3,LEFTPLAYEDTAB+1+3
  15172.  move.b d4,LEFTPLAYEDTAB+2+3
  15173.  move.b d3,vol1left
  15174.  move.l a1,pos1LEFT
  15175.  move.l a2,Samp1endLEFT
  15176. ; move.w #$8010,$dff000+intena
  15177.  rts
  15178.  
  15179. .chan2: 
  15180.  st NoiseMade2LEFT
  15181.  move.b d5,LEFTPLAYEDTAB+6
  15182.  move.b d3,LEFTPLAYEDTAB+1+6
  15183.  move.b d4,LEFTPLAYEDTAB+2+6
  15184.  move.l a1,pos2LEFT
  15185.  move.l a2,Samp2endLEFT
  15186.  move.b d3,vol2left
  15187. ; move.w #$8010,$dff000+intena
  15188.  rts
  15189.  
  15190. .chan4: 
  15191.  st NoiseMade0RIGHT
  15192.  move.b d5,RIGHTPLAYEDTAB
  15193.  move.b d3,RIGHTPLAYEDTAB+1
  15194.  move.b d4,RIGHTPLAYEDTAB+2
  15195.  move.l a1,pos0RIGHT
  15196.  move.l a2,Samp0endRIGHT
  15197.  move.b d4,vol0right
  15198. ; move.w #$8010,$dff000+intena
  15199.  rts
  15200.  
  15201. .chan5:
  15202.  st NoiseMade1RIGHT
  15203.  move.b d5,RIGHTPLAYEDTAB+3
  15204.  move.b d3,RIGHTPLAYEDTAB+1+3
  15205.  move.b d4,RIGHTPLAYEDTAB+2+3
  15206.  move.b d3,vol1right
  15207.  move.l a1,pos1RIGHT
  15208.  move.l a2,Samp1endRIGHT
  15209. ; move.w #$8010,$dff000+intena
  15210.  rts
  15211.  
  15212. .chan6: 
  15213.  st NoiseMade2RIGHT
  15214.  move.b d5,RIGHTPLAYEDTAB+6
  15215.  move.b d3,RIGHTPLAYEDTAB+1+6
  15216.  move.b d4,RIGHTPLAYEDTAB+2+6
  15217.  move.l a1,pos2RIGHT
  15218.  move.l a2,Samp2endRIGHT
  15219.  move.b d3,vol2right
  15220. ; move.w #$8010,$dff000+intena
  15221.  rts
  15222.  
  15223. SampleList:
  15224.  dc.l Scream,EndScream
  15225.  dc.l Shoot,EndShoot
  15226.  dc.l Munch,EndMunch
  15227.  dc.l PooGun,EndPooGun
  15228.  dc.l Collect,EndCollect
  15229. ;5
  15230.  dc.l DoorNoise,EndDoorNoise
  15231.  dc.l 0,0
  15232.  dc.l Stomp,EndStomp
  15233.  dc.l LowScream,EndLowScream
  15234.  dc.l BaddieGun,EndBaddieGun
  15235. ;10
  15236.  dc.l SwitchNoise,EndSwitch
  15237.  dc.l Reload,EndReload
  15238.  dc.l NoAmmo,EndNoAmmo
  15239.  dc.l Splotch,EndSplotch
  15240.  dc.l SplatPop,EndSplatPop
  15241. ;15
  15242.  dc.l Boom,EndBoom
  15243.  dc.l Hiss,EndHiss
  15244.  dc.l Howl1,EndHowl1
  15245.  dc.l Howl2,EndHowl2
  15246.  dc.l Pant,EndPant
  15247. ;20
  15248.  dc.l Whoosh,EndWhoosh
  15249.  dc.l ROAR,EndROAR
  15250.  dc.l whoosh,Endwhoosh
  15251.  dc.l 0,0
  15252.  dc.l 0,0
  15253.  dc.l 0,0
  15254.  dc.l 0,0
  15255.  dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  15256.  dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  15257.  dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  15258.  dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  15259.  
  15260.  dc.l 0
  15261.  
  15262. storeval: dc.w 0
  15263.  
  15264.  include "ab3:source_4000/wallchunk.s"
  15265.  include "ab3:source_4000/newloadfromdisk.s"
  15266.  include "ab3:source_4000/screensetup.s"
  15267.  include "ab3:source_4000/multiCONTROLLOOP.s"
  15268.  
  15269.  
  15270.  
  15271.  
  15272. saveinters:  
  15273.  dc.w 0
  15274.  
  15275. z: dc.w 10
  15276.  
  15277. notifplaying:
  15278.  dc.w 0
  15279.  
  15280. audpos1: dc.w 0
  15281. audpos1b: dc.w 0
  15282. audpos2: dc.w 0
  15283. audpos2b: dc.w 0
  15284. audpos3: dc.w 0
  15285. audpos3b: dc.w 0
  15286. audpos4: dc.w 0
  15287. audpos4b: dc.w 0
  15288.  
  15289. vol0left: dc.w 0
  15290. vol0right: dc.w 0
  15291. vol1left: dc.w 0
  15292. vol1right: dc.w 0
  15293. vol2left: dc.w 0
  15294. vol2right: dc.w 0
  15295. vol3left: dc.w 0
  15296. vol3right: dc.w 0
  15297.  
  15298. pos: dc.l 0
  15299.  
  15300. pos0LEFT: dc.l empty
  15301. pos1LEFT: dc.l empty
  15302. pos2LEFT: dc.l empty
  15303. pos3LEFT: dc.l empty
  15304. pos0RIGHT: dc.l empty
  15305. pos1RIGHT: dc.l empty
  15306. pos2RIGHT: dc.l empty
  15307. pos3RIGHT: dc.l empty
  15308.  
  15309. numtodo dc.w 0
  15310.  
  15311. npt: dc.w 0
  15312.  
  15313. pretab:
  15314. val SET 0
  15315.  REPT 128
  15316.  dc.b val
  15317. val SET val+1
  15318.  ENDR
  15319. val SET -128
  15320.  REPT 128
  15321.  dc.b val
  15322. val SET val+1
  15323.  ENDR 
  15324.  
  15325. tab:
  15326.  ifeq CHEESEY
  15327.  ds.b 256*65
  15328.  endc
  15329.  
  15330. test: dc.l 0
  15331.  ds.l 30
  15332.  
  15333.  
  15334.  even
  15335. ConstCols:
  15336. ; incbin "ConstCols"
  15337.  even
  15338. Smoothscalecols:
  15339. ; incbin "smoothbumppalscaled"
  15340.  even
  15341. SmoothTile:
  15342. ; incbin "smoothbumptile"
  15343.  even
  15344. Bumpscalecols:
  15345. ; incbin "Bumppalscaled"
  15346.  even
  15347. Bumptile:
  15348. ; incbin "bumptile"
  15349.  even
  15350. scalecols: ;incbin "bytepixpalscaled"
  15351.  even
  15352. ;floorscalecols:
  15353. ; incbin "floor256pal"
  15354. ; ds.w 256*4
  15355.  
  15356.  even
  15357. PaletteAddr: dc.l 0
  15358. ChunkAddr: dc.l 0
  15359. ;walltiles:
  15360. ; dc.l GreenMechanicWALL
  15361. ; dc.l BlueGreyMetalWALL
  15362. ; dc.l TechnoDetailWALL
  15363. ; dc.l BlueStoneWALL
  15364. ; dc.l RedAlertWALL
  15365. ; dc.l RockWALL
  15366. ;
  15367. ;GreenMechanicWALL: incbin "ab3:includes/walls/greenmechanic.wad"
  15368. ;BlueGreyMetalWALL: incbin "ab3:includes/walls/BlueGreyMetal.wad"
  15369. ;TechnoDetailWALL: incbin "ab3:includes/walls/TechnoDetail.wad"
  15370. ;BlueStoneWALL: incbin "ab3:includes/walls/bluestone.wad"
  15371. ;RedAlertWALL: incbin "ab3:includes/walls/redalert.wad"
  15372. ;RockWALL: incbin "ab3:includes/walls/rock.wad"
  15373.  
  15374. floortile:
  15375.  dc.l 0
  15376. ; incbin "floortile" 
  15377.  even
  15378. wallrouts:
  15379. ; incbin "2x2WallDraw" 
  15380.  CNOP 0,64
  15381.  
  15382.  ifeq CHEESEY 
  15383. BackPicture:
  15384.  dc.l 0
  15385. ; incbin "rawback"
  15386. EndBackPicture:
  15387.  endc
  15388.  
  15389. drawpt: dc.l 0
  15390. olddrawpt: dc.l 0
  15391. frompt: dc.l 0 
  15392.  
  15393. SineTable:
  15394.  incbin "bigsine"
  15395.  
  15396. angspd: dc.w 0
  15397. flooryoff: dc.w 0
  15398. xoff: dc.l 0
  15399. yoff: dc.l 0
  15400. yvel: dc.l 0
  15401. zoff: dc.l 0
  15402. tyoff: dc.l 0
  15403. xspdval: dc.l 0
  15404. zspdval: dc.l 0
  15405. Zone: dc.w 0
  15406.  
  15407. PLR1: dc.b $ff
  15408.  even
  15409. PLR1_energy: dc.w 191
  15410. PLR1_GunSelected: dc.w 0
  15411. PLR1_cosval: dc.w 0
  15412. PLR1_sinval: dc.w 0
  15413. PLR1_angpos: dc.w 0
  15414. PLR1_angspd: dc.w 0
  15415. PLR1_xoff: dc.l 0
  15416. PLR1_yoff: dc.l 0
  15417. PLR1_yvel: dc.l 0
  15418. PLR1_zoff: dc.l 0
  15419. PLR1_tyoff: dc.l 0
  15420. PLR1_xspdval: dc.l 0
  15421. PLR1_zspdval: dc.l 0
  15422. PLR1_Zone: dc.w 0
  15423. PLR1_Roompt: dc.l 0
  15424. PLR1_FloorSpd: dc.l 0
  15425. PLR2_FloorSpd: dc.l 0
  15426. PLR1_OldRoompt: dc.l 0
  15427. PLR1_PointsToRotatePtr: dc.l 0
  15428. PLR1_ListOfGraphRooms: dc.l 0
  15429. PLR1_oldxoff: dc.l 0
  15430. PLR1_oldzoff: dc.l 0
  15431. PLR1_StoodInTop: dc.b 0
  15432.  even
  15433. PLR1_height: dc.l 0
  15434. PLR1_RoomBright: dc.w 0
  15435.  
  15436. PLR3: dc.b $ff
  15437.  even
  15438. PLR3_energy: dc.w 191
  15439. PLR3_GunSelected: dc.w 0
  15440. PLR3_cosval: dc.w 0
  15441. PLR3_sinval: dc.w 0
  15442. PLR3_angpos: dc.w 0
  15443. PLR3_angspd: dc.w 0
  15444. PLR3_xoff: dc.l 0
  15445. PLR3_yoff: dc.l 0
  15446. PLR3_yvel: dc.l 0
  15447. PLR3_zoff: dc.l 0
  15448. PLR3_tyoff: dc.l 0
  15449. PLR3_xspdval: dc.l 0
  15450. PLR3_zspdval: dc.l 0
  15451. PLR3_Zone: dc.w 0
  15452. PLR3_Roompt: dc.l 0
  15453. PLR3_FloorSpd: dc.l 0
  15454. PLR3_OldRoompt: dc.l 0
  15455. PLR3_PointsToRotatePtr: dc.l 0
  15456. PLR3_ListOfGraphRooms: dc.l 0
  15457. PLR3_oldxoff: dc.l 0
  15458. PLR3_oldzoff: dc.l 0
  15459. PLR3_StoodInTop: dc.b 0
  15460.  even
  15461. PLR3_height: dc.l 0
  15462. PLR3_RoomBright: dc.w 0
  15463.  
  15464.  
  15465. DOUBLEWIDTH: dc.b $0,0
  15466. DOUBLEHEIGHT: dc.b 0,0
  15467. PLR1_TELEPORTED: dc.w 0
  15468. PLR2_TELEPORTED: dc.w 0
  15469. PLR3_TELEPORTED: dc.w 0
  15470.  
  15471.  ds.w 4
  15472.  
  15473. OLDX1: dc.l 0
  15474. OLDX2: dc.l 0
  15475. OLDX3: dc.l 0
  15476. OLDZ1: dc.l 0
  15477. OLDZ2: dc.l 0
  15478. OLDZ3: dc.l 0
  15479.  
  15480. XDIFF1: dc.l 0
  15481. ZDIFF1: dc.l 0
  15482. XDIFF2: dc.l 0
  15483. ZDIFF2: dc.l 0
  15484. XDIFF3: dc.l 0
  15485. ZDIFF3: dc.l 0
  15486.  
  15487. PLR1s_cosval: dc.w 0
  15488. PLR1s_sinval: dc.w 0
  15489. PLR1s_angpos: dc.w 0
  15490. PLR1s_angspd: dc.w 0
  15491. PLR1s_xoff: dc.l 0
  15492. PLR1s_yoff: dc.l 0
  15493. PLR1s_yvel: dc.l 0
  15494. PLR1s_zoff: dc.l 0
  15495. PLR1s_tyoff: dc.l 0
  15496. PLR1s_xspdval: dc.l 0
  15497. PLR1s_zspdval: dc.l 0
  15498. PLR1s_Zone: dc.w 0
  15499. PLR1s_Roompt: dc.l 0
  15500. PLR1s_OldRoompt: dc.l 0
  15501. PLR1s_PointsToRotatePtr: dc.l 0
  15502. PLR1s_ListOfGraphRooms: dc.l 0
  15503. PLR1s_oldxoff: dc.l 0
  15504. PLR1s_oldzoff: dc.l 0
  15505. PLR1s_height: dc.l 0
  15506. PLR1s_targheight: dc.l 0
  15507.  
  15508. PLR1_Echo: dc.w 0
  15509.  
  15510. p1_xoff: dc.l 0
  15511. p1_zoff: dc.l 0
  15512. p1_yoff: dc.l 0
  15513. p1_height: dc.l 0
  15514. p1_angpos: dc.w 0
  15515. p1_bobble: dc.w 0
  15516. p1_clicked: dc.b 0
  15517. p1_spctap: dc.b 0
  15518. p1_ducked: dc.b 0
  15519. p1_gunselected: dc.b 0
  15520. p1_fire: dc.b 0
  15521.  even
  15522. p1_holddown: dc.w 0
  15523.  
  15524. PLR3s_cosval: dc.w 0
  15525. PLR3s_sinval: dc.w 0
  15526. PLR3s_angpos: dc.w 0
  15527. PLR3s_angspd: dc.w 0
  15528. PLR3s_xoff: dc.l 0
  15529. PLR3s_yoff: dc.l 0
  15530. PLR3s_yvel: dc.l 0
  15531. PLR3s_zoff: dc.l 0
  15532. PLR3s_tyoff: dc.l 0
  15533. PLR3s_xspdval: dc.l 0
  15534. PLR3s_zspdval: dc.l 0
  15535. PLR3s_Zone: dc.w 0
  15536. PLR3s_Roompt: dc.l 0
  15537. PLR3s_OldRoompt: dc.l 0
  15538. PLR3s_PointsToRotatePtr: dc.l 0
  15539. PLR3s_ListOfGraphRooms: dc.l 0
  15540. PLR3s_oldxoff: dc.l 0
  15541. PLR3s_oldzoff: dc.l 0
  15542. PLR3s_height: dc.l 0
  15543. PLR3s_targheight: dc.l 0
  15544.  
  15545. PLR3_Echo: dc.w 0
  15546.  
  15547. p3_xoff: dc.l 0
  15548. p3_zoff: dc.l 0
  15549. p3_yoff: dc.l 0
  15550. p3_height: dc.l 0
  15551. p3_angpos: dc.w 0
  15552. p3_bobble: dc.w 0
  15553. p3_clicked: dc.b 0
  15554. p3_spctap: dc.b 0
  15555. p3_ducked: dc.b 0
  15556. p3_gunselected: dc.b 0
  15557. p3_fire: dc.b 0
  15558.  even
  15559. p3_holddown: dc.w 0
  15560.  
  15561.  
  15562.  ds.w 4
  15563.  
  15564. PLR2: dc.b $ff
  15565.  even
  15566. PLR2_GunSelected: dc.w 0
  15567. PLR2_energy: dc.w 191
  15568. PLR2_cosval: dc.w 0
  15569. PLR2_sinval: dc.w 0
  15570. PLR2_angpos: dc.w 0
  15571. PLR2_angspd: dc.w 0
  15572. PLR2_xoff: dc.l 0
  15573. PLR2_yoff: dc.l 0
  15574. PLR2_yvel: dc.l 0
  15575. PLR2_zoff: dc.l 0
  15576. PLR2_tyoff: dc.l 0
  15577. PLR2_xspdval: dc.l 0
  15578. PLR2_zspdval: dc.l 0
  15579. PLR2_Zone: dc.w 0
  15580. PLR2_Roompt: dc.l 0
  15581. PLR2_OldRoompt: dc.l 0
  15582. PLR2_PointsToRotatePtr: dc.l 0
  15583. PLR2_ListOfGraphRooms: dc.l 0
  15584. PLR2_oldxoff: dc.l 0
  15585. PLR2_oldzoff: dc.l 0
  15586. PLR2_StoodInTop: dc.b 0
  15587.  even
  15588. PLR2_height: dc.l 0
  15589. PLR2_Echo: dc.w 0
  15590. Echo: dc.w 0
  15591.  
  15592.  ds.w 4
  15593.  
  15594. PLR2s_cosval: dc.w 0
  15595. PLR2s_sinval: dc.w 0
  15596. PLR2s_angpos: dc.w 0
  15597. PLR2s_angspd: dc.w 0
  15598. PLR2s_xoff: dc.l 0
  15599. PLR2s_yoff: dc.l 0
  15600. PLR2s_yvel: dc.l 0
  15601. PLR2s_zoff: dc.l 0
  15602. PLR2s_tyoff: dc.l 0
  15603. PLR2s_xspdval: dc.l 0
  15604. PLR2s_zspdval: dc.l 0
  15605. PLR2s_Zone: dc.w 0
  15606. PLR2s_Roompt: dc.l 0
  15607. PLR2s_OldRoompt: dc.l 0
  15608. PLR2s_PointsToRotatePtr: dc.l 0
  15609. PLR2s_ListOfGraphRooms: dc.l 0
  15610. PLR2s_oldxoff: dc.l 0
  15611. PLR2s_oldzoff: dc.l 0
  15612. PLR2s_height: dc.l 0
  15613. PLR2s_targheight: dc.l 0
  15614.  
  15615.  ds.w 4
  15616.  
  15617. p2_xoff: dc.l 0
  15618. p2_zoff: dc.l 0
  15619. p2_yoff: dc.l 0
  15620. p2_height: dc.l 0
  15621. p2_angpos: dc.w 0
  15622. p2_bobble: dc.w 0
  15623. p2_clicked: dc.b 0
  15624. p2_spctap: dc.b 0
  15625. p2_ducked: dc.b 0
  15626. p2_gunselected: dc.b 0
  15627. p2_fire: dc.b 0
  15628.  even
  15629. p2_holddown: dc.w 0
  15630.  
  15631. liftanimtab:
  15632.  
  15633. endliftanimtab:
  15634.  
  15635. glassball:
  15636. ; incbin "glassball.inc"
  15637.  
  15638. endglass
  15639. glassballpt: dc.l glassball
  15640.  
  15641. rndtab: ; incbin "randfile"
  15642. endrnd: 
  15643.  
  15644. brightanimtab:
  15645. ; dcb.w 200,20
  15646. ; dc.w 5
  15647. ; dc.w 10,20
  15648. ; dc.w 5
  15649. ; dcb.w 30,20
  15650. ; dc.w 7,10,10,5,10,0,5,6,5,6,5,6,5,6,0
  15651. ; dcb.w 40,0
  15652. ; dc.w 1,2,3,2,3,2,3,2,3,2,3,2,3,0
  15653. ; dcb.w 300,0
  15654. ; dc.w 1,0,1,0,2,2,2,5,5,5,5,5,5,5,5,5,6,10
  15655. ; dc.w -1
  15656.  
  15657. Roompt: dc.l 0
  15658. OldRoompt: dc.l 0
  15659.  
  15660. *****************************************************************
  15661.  *
  15662.  include "AB3:source_4000/multiLevelData2"
  15663.  *
  15664. *****************************************************************
  15665.  
  15666.  
  15667. wallpt: dc.l 0
  15668. floorpt: dc.l 0
  15669.  
  15670. Rotated:
  15671.  ds.l 2*800 
  15672. ObjRotated:
  15673.  ds.l 2*500
  15674.  
  15675. OnScreen:
  15676.  ds.l 2*800 
  15677.  
  15678. startwait: dc.w 0
  15679. endwait: dc.w 0
  15680.  
  15681. ;Faces:
  15682. ; incbin "faces2raw"
  15683.  
  15684. LINKS: dc.l 0
  15685. FLYLINKS: dc.l 0
  15686. *************************************************************
  15687.  
  15688. consttab:
  15689.  ds.b 65536
  15690.  
  15691. ; incbin "constantfile"
  15692.  
  15693. *******************************************************************
  15694.  
  15695.  
  15696.  
  15697. *********************************
  15698.  
  15699. ; include "ab3:source_4000/loadmod.a"
  15700. ; include "ab3:source_4000/proplayer.a"
  15701.  
  15702.  
  15703. darkentab: 
  15704. ;val SET 0
  15705. ; REPT 256
  15706. ; dc.b val
  15707. ;val SET val+1
  15708. ; ENDR
  15709. ; incbin "darkenfile"
  15710.  
  15711.     dc.w 0
  15712. MIDDLEX: dc.w 0
  15713. RIGHTX: dc.w 192
  15714. FULLSCR: dc.w 0
  15715.  
  15716. ;SHADINGTABLE: incbin "SHADEFILE" 
  15717.  
  15718. ******************************************
  15719. * Link file !*****************************
  15720. ******************************************
  15721.  
  15722. LINKSPACE:
  15723. ; ds.l 22500
  15724. ; incbin "ab3:includes/test.lnk"
  15725.  
  15726. LINKname:
  15727.  dc.b "TKG1:includes/test.lnk",0
  15728.  even
  15729.  
  15730. LINKFILE:
  15731.  dc.l LINKSPACE
  15732.  
  15733. ******************************************
  15734.  
  15735.  
  15736. ;brightentab:
  15737. ; incbin "brightenfile"
  15738. WorkSpace:
  15739.  ds.l 8192 
  15740. waterfile:
  15741.  incbin "waterfile"
  15742.  
  15743.  SECTION ffff,CODE_C
  15744.  
  15745. nullspr: dc.l 0
  15746.  
  15747.  cnop 0,8
  15748. ;borders:
  15749. ; incbin "newleftbord"
  15750. ; incbin "newrightbord"
  15751.  
  15752. health: 
  15753. ;incbin "healthstrip"
  15754. Ammunition: 
  15755. ;incbin "ammostrip"
  15756. healthpal: 
  15757. ;incbin "healthpal"
  15758. PanelKeys: 
  15759. ;incbin "greenkey"
  15760. ; incbin "redkey"
  15761. ; incbin "yellowkey"
  15762. ; incbin "bluekey"
  15763.  
  15764. null: ds.w 500
  15765. null2: ds.w 500
  15766. null3: ds.w 500
  15767. null4: ds.w 500
  15768.  
  15769.  
  15770. Blurbfield:
  15771.  
  15772.  dc.w bpl1ptl
  15773. bl1l: dc.w 0
  15774.  dc.w bpl1pth
  15775. bl1h: dc.w 0
  15776.  
  15777.  dc.w diwstart,$2c81
  15778.  dc.w diwstop,$1cc1
  15779.  dc.w ddfstart,$38
  15780.  dc.w ddfstop,$b8
  15781.  dc.w bplcon0,$9201
  15782.  dc.w bplcon1,0
  15783.  dc.w $106,$c40
  15784. blcols:
  15785.  dc.w col0,0
  15786.  dc.w col1,$fff
  15787.  
  15788.  dc.w $108,0
  15789.  dc.w $10a,0
  15790.  
  15791.  dc.w $ffff,$fffe
  15792.  dc.w $ffff,$fffe
  15793.  
  15794. nullline:
  15795.  ds.b 80    
  15796.  
  15797.  include "ab3:source_4000/titlecop.s"
  15798.  
  15799. bigfield:    
  15800.                 ; Start of our copper list.
  15801.  dc.w dmacon,$8020
  15802.  dc.w intreq,$8011
  15803.  dc.w $1fc,$f
  15804.  dc.w diwstart
  15805. winstart: dc.w $2c81
  15806.  dc.w diwstop
  15807. winstop: dc.w $2cc1
  15808.  dc.w ddfstart
  15809. fetchstart: dc.w $38
  15810.  dc.w ddfstop
  15811. fetchstop: dc.w $b8
  15812.  
  15813. bordercols:
  15814.  incbin "borderpal"
  15815.  
  15816.  dc.w spr0ptl
  15817. s0l:
  15818.  dc.w 0
  15819.  dc.w spr0pth
  15820. s0h:
  15821.  dc.w 0
  15822.  dc.w spr1ptl
  15823. s1l:
  15824.  dc.w 0
  15825.  dc.w spr1pth
  15826. s1h:
  15827.  dc.w 0
  15828.  dc.w spr2ptl
  15829. s2l:
  15830.  dc.w 0
  15831.  dc.w spr2pth
  15832. s2h:
  15833.  dc.w 0
  15834.  dc.w spr3ptl
  15835. s3l:
  15836.  dc.w 0
  15837.  dc.w spr3pth
  15838. s3h:
  15839.  dc.w 0
  15840.  dc.w spr4ptl
  15841. s4l:
  15842.  dc.w 0
  15843.  dc.w spr4pth
  15844. s4h:
  15845.  dc.w 0
  15846.  dc.w spr5ptl
  15847. s5l:
  15848.  dc.w 0
  15849.  dc.w spr5pth
  15850. s5h:
  15851.  dc.w 0
  15852.  dc.w spr6ptl
  15853. s6l:
  15854.  dc.w 0
  15855.  dc.w spr6pth
  15856. s6h:
  15857.  dc.w 0
  15858.  dc.w spr7ptl
  15859. s7l:
  15860.  dc.w 0
  15861.  dc.w spr7pth
  15862. s7h:
  15863.  dc.w 0
  15864.  
  15865. ; dc.w $106,$c42
  15866. ; incbin "borderpal"
  15867.  
  15868.  dc.w $106,$c42
  15869.  
  15870.  dc.w bplcon0,$0211
  15871.  dc.w bplcon1
  15872. smoff:
  15873.  dc.w $0
  15874.  
  15875.  dc.w $108
  15876. modulo: dc.w 0
  15877.  dc.w $10a,0
  15878.  
  15879.  dc.w $1001,$ff00
  15880.  dc.w intreq,$11
  15881.  
  15882. PALETTESPACE:
  15883.  dcb.l 528,$1fe0000
  15884.  
  15885.  dc.w $2001,$ff00
  15886.  
  15887.  dc.w bpl1pth
  15888. pl1h
  15889.  dc.w 0
  15890.  
  15891.  dc.w bpl1ptl
  15892. pl1l
  15893.  dc.w 0
  15894.  
  15895.  dc.w bpl2pth
  15896. pl2h
  15897.  dc.w 0
  15898.  
  15899.  dc.w bpl2ptl
  15900. pl2l
  15901.  dc.w 0
  15902.  
  15903.  dc.w bpl3pth
  15904. pl3h
  15905.  dc.w 0
  15906.  
  15907.  dc.w bpl3ptl
  15908. pl3l
  15909.  dc.w 0
  15910.  
  15911.  dc.w bpl4pth
  15912. pl4h
  15913.  dc.w 0
  15914.  
  15915.  dc.w bpl4ptl
  15916. pl4l
  15917.  dc.w 0
  15918.  
  15919.  dc.w bpl5pth
  15920. pl5h
  15921.  dc.w 0
  15922.  
  15923.  dc.w bpl5ptl
  15924. pl5l
  15925.  dc.w 0
  15926.  
  15927.  dc.w bpl6pth
  15928. pl6h
  15929.  dc.w 0
  15930.  
  15931.  dc.w bpl6ptl
  15932. pl6l
  15933.  dc.w 0
  15934.  
  15935.  dc.w bpl7pth
  15936. pl7h
  15937.  dc.w 0
  15938.  
  15939.  dc.w bpl7ptl
  15940. pl7l
  15941.  dc.w 0
  15942.  
  15943.  dc.w bpl8pth
  15944. pl8h
  15945.  dc.w 0
  15946.  
  15947.  dc.w bpl8ptl
  15948. pl8l
  15949.  dc.w 0
  15950.  
  15951.  
  15952. val SET $2c
  15953. SCRMODULOS:
  15954.  REPT 232
  15955.  dc.b val,1,$ff,$fe
  15956.  dc.w $108,0
  15957.  dc.w $10a,0
  15958.  dc.b val,$df,$ff,$fe
  15959. val SET (val+1)&$ff
  15960.  ENDR
  15961.  
  15962.  dc.w $108,0,$10a,0
  15963.  dc.w $2401,$ff00
  15964.  dc.w ddfstop,$c8
  15965.  dc.w bplcon0,$9201
  15966.  dc.w bpl1ptl
  15967. scroll:
  15968.  dc.w 0
  15969.  dc.w bpl1pth
  15970. scrolh:
  15971.  dc.w 0
  15972.  
  15973.  dc.w $106,$c40
  15974.  dc.w $180,0
  15975.  dc.w $182,$f0
  15976. ; dc.w $108,40
  15977. ; dc.w $10a,40
  15978.  
  15979. ; dc.w $80
  15980. ;JUMPBACKH:
  15981. ; dc.w 0
  15982. ; dc.w $82
  15983. ;JUMPBACKL:
  15984. ; dc.w 0
  15985.  
  15986. ; dc.w $8a,0
  15987.  
  15988.  dc.w $ffff,$fffe
  15989.  dc.w $ffff,$fffe
  15990.  
  15991. PALETTEBIT:
  15992.  incbin "256palette"
  15993.  dc.w $ffff,$fffe
  15994.  
  15995. yposcop:
  15996. ; dc.w $2a11,$fffe
  15997. ; dc.w $8a,0
  15998.  
  15999. ; ds.l 104*12
  16000.  
  16001. ;colbars:
  16002. ;val SET $2a
  16003. ; dcb.l 104*80,$1fe0000
  16004. ; dc.w $106,$c42
  16005. ; dc.w $80
  16006. ;pch1:
  16007. ; dc.w 0
  16008. ; dc.w $82
  16009. ;pcl1:
  16010. ; dc.w 0 
  16011. ; dc.w $88,0
  16012. ; dc.w $ffff,$fffe       ; End copper list.
  16013.  
  16014. ; ds.l 104*12
  16015.  
  16016.  
  16017. ;colbars2:
  16018. ;val SET $2a
  16019. ; dcb.l 104*80,$1fe0000
  16020. ; dc.w $106,$c42
  16021. ; dc.w $80
  16022. ;pch2:
  16023. ; dc.w 0
  16024. ; dc.w $82
  16025. ;pcl2:
  16026. ; dc.w 0
  16027. ; dc.w $88,0
  16028. ; dc.w $ffff,$fffe       ; End copper list.
  16029.  
  16030. ; ds.l 104*10
  16031.  
  16032. NullCopper:
  16033.  dc.w $ffff,$fffe
  16034.  
  16035. hitcol: dc.l 0
  16036.  
  16037. old: dc.l 0
  16038.  
  16039.  CNOP 0,64
  16040. SCROLLSCRN: ds.l 20*16
  16041.  
  16042. SCROLLOFFSET: dc.w 0
  16043. SCROLLTIMER: dc.w 100
  16044. SCROLLDIRECTION: dc.w 1
  16045. SCROLLXPOS: dc.w 0
  16046. SCROLLPOINTER: dc.l testscroll
  16047. ENDSCROLL: dc.l endtestscroll
  16048.  
  16049. testscroll:
  16050. ;      12345678901234567890123456789012345678901234567890123456789012345678901234567890
  16051. ; dc.b "The Quick Brown Fox Jumped Over The Lazy Dog!                                   "
  16052. ; dc.b "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ                            "
  16053. ; dc.b "The Quick Brown Fox Jumped Over The Lazy Dog!                                   "
  16054.  
  16055. BLANKSCROLL:
  16056.  dc.b "                                                                                "
  16057. endtestscroll: 
  16058.  
  16059. prot5: dc.w 0
  16060. PanelCop:
  16061.  
  16062.  dc.w $80
  16063. och:
  16064.  dc.w 0
  16065.  dc.w $82
  16066. ocl:
  16067.  dc.w 0
  16068.  
  16069. statskip:
  16070.  dc.w $1fe,0
  16071.  dc.w $1fe,0
  16072.  
  16073.  dc.w $10c,0
  16074.  dc.w bplcon0,$1201
  16075.  dc.w bpl1ptl
  16076. n1l:
  16077.  dc.w 0
  16078.  dc.w bpl1pth
  16079. n1h:
  16080.  dc.w 0
  16081.  dc.w $108,-24
  16082. ; incbin "Panelpal"
  16083.  
  16084.  dc.w bpl2pth
  16085. p2h
  16086.  dc.w 0
  16087.  
  16088.  dc.w bpl2ptl
  16089. p2l
  16090.  dc.w 0
  16091.  
  16092.  dc.w bpl3pth
  16093. p3h
  16094.  dc.w 0
  16095.  
  16096.  dc.w bpl3ptl
  16097. p3l
  16098.  dc.w 0
  16099.  
  16100.  dc.w bpl4pth
  16101. p4h
  16102.  dc.w 0
  16103.  dc.w bpl4ptl
  16104. p4l
  16105.  dc.w 0
  16106.  dc.w bpl5pth
  16107. p5h
  16108.  dc.w 0
  16109.  dc.w bpl5ptl
  16110. p5l
  16111.  dc.w 0
  16112.  dc.w bpl6pth
  16113. p6h
  16114.  dc.w 0
  16115.  dc.w bpl6ptl
  16116. p6l
  16117.  dc.w 0
  16118.  dc.w bpl7pth
  16119. p7h
  16120.  dc.w 0
  16121.  dc.w bpl7ptl
  16122. p7l
  16123.  dc.w 0
  16124.  dc.w bpl8pth
  16125. p8h
  16126.  dc.w 0
  16127.  dc.w bpl8ptl
  16128. p8l
  16129.  dc.w 0
  16130.  
  16131.  
  16132.  dc.w ddfstart,$38
  16133.  dc.w ddfstop,$b8
  16134.  dc.w diwstart,$2c81
  16135.  dc.w diwstop,$2cc1
  16136.  
  16137.  dc.w bplcon0
  16138. Panelcon: dc.w $0211
  16139.  dc.w bpl1pth
  16140. p1h
  16141.  dc.w 0
  16142.  
  16143.  dc.w bpl1ptl
  16144. p1l
  16145.  dc.w 0
  16146.  
  16147.  
  16148.  dc.w $108,40*7
  16149.  dc.w $10a,40*7
  16150.  
  16151.  dc.w $ffff,$fffe
  16152.  
  16153.  dc.w $180,$fff
  16154.  
  16155.  
  16156.  dc.w $f801,$ff00
  16157.  dc.w col1,$50
  16158.  dc.w $f901,$ff00
  16159.  dc.w col1,$90
  16160.  dc.w $fa01,$ff00
  16161.  dc.w col1,$f0
  16162.  dc.w $fb01,$ff00
  16163.  dc.w col1,$f0
  16164.  dc.w $fc01,$ff00
  16165.  dc.w col1,$90
  16166.  dc.w $fd01,$ff00
  16167.  dc.w col1,$50
  16168.  
  16169.  dc.w $fe01,$ff00
  16170.  dc.w col1,$fff
  16171.  
  16172.  dc.w $ffdf,$fffe
  16173.  dc.w $a01,$ff00
  16174.  dc.w bplcon0,$201
  16175.  
  16176. ; incbin "faces2cols"
  16177.  dc.w bpl1pth
  16178. f1h
  16179.  dc.w 0
  16180.  
  16181.  dc.w bpl1ptl
  16182. f1l
  16183.  dc.w 0
  16184.  
  16185.  dc.w bpl2pth
  16186. f2h
  16187.  dc.w 0
  16188.  
  16189.  dc.w bpl2ptl
  16190. f2l
  16191.  dc.w 0
  16192.  
  16193.  dc.w bpl3pth
  16194. f3h
  16195.  dc.w 0
  16196.  
  16197.  dc.w bpl3ptl
  16198. f3l
  16199.  dc.w 0
  16200.  
  16201.  dc.w bpl4pth
  16202. f4h
  16203.  dc.w 0
  16204.  dc.w bpl4ptl
  16205. f4l
  16206.  dc.w 0
  16207.  
  16208.  dc.w bpl5pth
  16209. f5h
  16210.  dc.w 0
  16211.  dc.w bpl5ptl
  16212. f5l
  16213.  dc.w 0
  16214.  
  16215.  dc.w $0c01,$ff00
  16216.  dc.w bplcon0,$5201
  16217.   
  16218.  dc.w $ffff,$fffe
  16219.  
  16220.  cnop 0,64
  16221. FacePlace:
  16222. ; ds.l 6*32*5
  16223.  
  16224. TEXTSCRN: dc.l 0
  16225.  
  16226. TEXTCOP:
  16227.  dc.w intreq,$8030
  16228.  
  16229.  dc.w spr0ptl
  16230. txs0l:
  16231.  dc.w 0
  16232.  dc.w spr0pth
  16233. txs0h:
  16234.  dc.w 0
  16235.  dc.w spr1ptl
  16236. txs1l:
  16237.  dc.w 0
  16238.  dc.w spr1pth
  16239. txs1h:
  16240.  dc.w 0
  16241.  dc.w spr2ptl
  16242. txs2l:
  16243.  dc.w 0
  16244.  dc.w spr2pth
  16245. txs2h:
  16246.  dc.w 0
  16247.  dc.w spr3ptl
  16248. txs3l:
  16249.  dc.w 0
  16250.  dc.w spr3pth
  16251. txs3h:
  16252.  dc.w 0
  16253.  dc.w spr4ptl
  16254. txs4l:
  16255.  dc.w 0
  16256.  dc.w spr4pth
  16257. txs4h:
  16258.  dc.w 0
  16259.  dc.w spr5ptl
  16260. txs5l:
  16261.  dc.w 0
  16262.  dc.w spr5pth
  16263. txs5h:
  16264.  dc.w 0
  16265.  dc.w spr6ptl
  16266. txs6l:
  16267.  dc.w 0
  16268.  dc.w spr6pth
  16269. txs6h:
  16270.  dc.w 0
  16271.  dc.w spr7ptl
  16272. txs7l:
  16273.  dc.w 0
  16274.  dc.w spr7pth
  16275. txs7h:
  16276.  dc.w 0
  16277.  
  16278.  
  16279.  dc.w $10c,$0088
  16280.  
  16281.  dc.w $1fc,$f
  16282.  dc.w diwstart,$2c81    ; Top left corner of screen.
  16283.  dc.w diwstop
  16284. BOTOFTXT:
  16285.  dc.w $2cc1     ; Bottom right corner of screen.
  16286.  dc.w ddfstart,$38      ; Data fetch start.
  16287.  dc.w ddfstop,$c8       ; Data fetch stop.
  16288.  
  16289.  dc.w bplcon0
  16290. TSCP:
  16291.  dc.w $a201
  16292.  
  16293.  dc.w $106,$c40
  16294.  
  16295.  dc.w $2a01,$ff00
  16296.  
  16297.  dc.w col0
  16298. backc: dc.w 0
  16299.  dc.w col1
  16300. TOPLET:
  16301. TXTCOLL:
  16302.  dc.w 0
  16303.   dc.w col2
  16304. BOTLET:
  16305. TOPCOLL:
  16306.  dc.w 0
  16307.  dc.w col3
  16308. ALLTEXT:
  16309. MIXCOLL:
  16310.  dc.w $fff
  16311.  dc.w $106,$e40
  16312.  dc.w col3
  16313. ALLTEXTLOW:
  16314.  dc.w $0
  16315.  
  16316.  
  16317.  dc.w bpl1pth
  16318. TSPTh:
  16319.  dc.w 0
  16320.  dc.w bpl1ptl
  16321. TSPTl:
  16322.  dc.w 0
  16323.  
  16324.  dc.w bpl2pth
  16325. TSPTh2:
  16326.  dc.w 0
  16327.  dc.w bpl2ptl
  16328. TSPTl2:
  16329.  dc.w 0
  16330.  
  16331.  
  16332.  dc.w $108,0
  16333.  dc.w $10a,0
  16334.  
  16335.  dc.w $ffff,$fffe
  16336.  
  16337. ********************************************
  16338. * Stuff you don't have to worry about yet. *
  16339. ********************************************
  16340.  
  16341. closeeverything:
  16342.  
  16343. ; jsr mt_end
  16344.  
  16345.  move.l #nullcop,d0
  16346. ; move.l old,d0
  16347.  
  16348.  
  16349. ;charlie  
  16350.  move.l d0,$dff080     ; Restore old copper list.
  16351.  move.w d0,ocl
  16352.  swap d0
  16353.  move.w d0,och
  16354.  
  16355. ; move.l doslib,a6
  16356. ; move.l #4,d1
  16357. ; jsr -198(a6)
  16358.  
  16359. ; move.l doslib,d0
  16360. ; move.l d0,a1
  16361. ; move.l 4.w,a6
  16362. ; jsr CloseLib(a6)
  16363.  
  16364.  move.l #$dff000,a6
  16365.  move.w #$8020,dmacon(a6)
  16366.  move.w #$f,dmacon(a6)
  16367.  
  16368. ; move.l 4.w,a6
  16369. ; lea VBLANKInt,a1
  16370. ; moveq #INTB_COPER,d0
  16371. ; jsr _LVORemIntServer(a6)
  16372.  
  16373. ; IFEQ CD32VER
  16374. ; move.l OLDKINT,$68.w
  16375. ; ENDC
  16376. ; move.w saveinters,d0
  16377. ; or.w #$c000,d0
  16378. ; move.w d0,intena(a6)
  16379.  clr.w $dff0a8
  16380.  clr.w $dff0b8
  16381.  clr.w $dff0c8
  16382.  clr.w $dff0d8
  16383.  
  16384.  
  16385. ; move.l oldview,a1
  16386. ; move.l a1,d0
  16387. ; move.l gfxbase,a6
  16388. ; jsr -$de(a6)
  16389.  
  16390. ; cmp.b #'s',mors
  16391. ; beq.s leaveold
  16392. ; move.w #$f8e,$dff1dc
  16393. ;leaveold:
  16394.  
  16395.  jsr RELEASELEVELMEM
  16396.  jsr RELEASESCRNMEM
  16397.  
  16398.  move.l #0,d0
  16399.  
  16400.  rts
  16401.  
  16402.  
  16403.  
  16404. intbase: dc.l 0
  16405. gfxbase: dc.l 0
  16406. oldview: dc.l 0
  16407. oldcopper: dc.l 0
  16408.  
  16409. stuff:
  16410.  
  16411.     Lea    gfxname(pc),a1    
  16412.     Moveq.l    #0,d0
  16413.     Move.l    $4.w,a6    
  16414.     Jsr    -$228(a6)
  16415.     add.w d1,RVAL1
  16416.     Move.l     d0,gfxbase
  16417.     Move.l    d0,a6                Use As Base Reg
  16418.     Move.l    34(a6),oldview
  16419.     move.l 38(a6),old
  16420.     move.l 38(a6),oldcopper
  16421.     rts
  16422.  
  16423. gfxname dc.b "graphics.library",0
  16424.  even
  16425. INTUNAME    dc.b    "intuition.library",0
  16426.  
  16427.  even
  16428.  
  16429.  
  16430.  cnop 0,64
  16431.  
  16432. Panel:
  16433.  dc.l 0
  16434.  
  16435. TimerScr: 
  16436. ;ds.b 40*64
  16437.  
  16438. scrntab:
  16439.  ds.b 16
  16440. val SET 32
  16441.  REPT 96
  16442.  dc.b val,val,val
  16443. val SET val+1
  16444.  ENDR
  16445.  ds.b 16
  16446.  
  16447. smallscrntab:
  16448. val SET 32
  16449.  REPT 96
  16450.  dc.b val,val
  16451. val SET val+1
  16452.  ENDR
  16453.  
  16454.  cnop 0,64
  16455. scrn:
  16456.  dc.l 0
  16457. ; incbin "ab3:includes/newborderRAW"
  16458. ; ds.b 80
  16459. scrn2:
  16460.  dc.l 0
  16461.  
  16462. ;flib:
  16463. ; incbin "ab3:includes/newborderRAW"
  16464. ; ds.b 80
  16465. ;flib2:
  16466. ; incbin "ab3:includes/newborderRAW"
  16467. ; ds.b 80
  16468.  
  16469. ; incbin "ab3:includes/newborderRAW"
  16470. ; ds.b 80
  16471.  
  16472. SCRNDRAWPT: dc.l 0
  16473. SCRNSHOWPT: dc.l 0
  16474.  
  16475. ; dcb.l 8,$33333333
  16476. ; dc.l 0
  16477. ; dc.l 0
  16478. ; dcb.l 8,$0f0f0f0f
  16479. ; dc.l 0
  16480. ; dc.l 0
  16481. ;
  16482. ; dcb.l 8,$00ff00ff
  16483. ; dc.l 0
  16484. ; dc.l 0
  16485. ; dcb.l 8,$0000ffff
  16486. ; dc.l 0
  16487. ; dc.l 0
  16488. ; dc.l 0,-1,0,-1,0,-1,0,-1
  16489. ; dc.l 0
  16490. ; dc.l 0
  16491. ; dc.l -1,-1,0,0,-1,-1,0,0
  16492. ; dc.l 0
  16493. ; dc.l 0
  16494. ; dc.l 0,0,-1,-1,-1,-1,-1,-1
  16495. ; dc.l 0
  16496. ; dc.l 0
  16497.  
  16498. NumTimes: dc.l 0
  16499. TimeCount: dc.l 0
  16500. oldtime: dc.l 0
  16501. counting: dc.b 0
  16502. oktodisplay: dc.b 0
  16503.  
  16504. INITTIMER:
  16505.  move.l #0,TimeCount
  16506.  move.l #0,NumTimes
  16507.  rts
  16508.  
  16509. STARTCOUNT:
  16510.  move.l d0,-(a7)
  16511.  move.l $dff004,d0
  16512.  and.l #$1ffff,d0
  16513.  move.l d0,oldtime
  16514.  st counting
  16515.  move.l (a7)+,d0
  16516.  rts
  16517.  
  16518. STOPCOUNT:
  16519.  move.l d0,-(a7)
  16520.  move.l $dff004,d0
  16521.  and.l #$1ffff,d0
  16522.  
  16523.  sub.l oldtime,d0
  16524.  cmp.l #-256,d0
  16525.  bge.s okcount
  16526.  add.l #313*256,d0
  16527. okcount:
  16528.  add.l d0,TimeCount
  16529.  addq.l #1,NumTimes
  16530.  clr.b counting
  16531.  move.l (a7)+,d0
  16532.  rts
  16533.  
  16534. STOPCOUNTNOADD:
  16535.  move.l d0,-(a7)
  16536.  move.l $dff004,d0
  16537.  and.l #$1ffff,d0
  16538.  
  16539.  sub.l oldtime,d0
  16540.  cmp.l #-256,d0
  16541.  bge.s okcount2
  16542.  add.l #313*256,d0
  16543. okcount2:
  16544.  add.l d0,TimeCount
  16545.  clr.b counting
  16546.  move.l (a7)+,d0
  16547.  rts
  16548.  
  16549. maxbot: dc.w 0
  16550. tstneg: dc.l 0
  16551.  
  16552. STOPTIMER:
  16553.  st oktodisplay
  16554.  rts
  16555.  
  16556. digits: incbin "numbers.inc"
  16557.  
  16558. COMPACTMAP: ds.l 257
  16559.  
  16560. BIGMAP: ds.l 256*10
  16561.  
  16562.  Section Sounds,CODE_C
  16563.  
  16564. nullcop:
  16565.  dc.w $106,$c40
  16566.  dc.w $180,0 
  16567.  dc.w $100,$0
  16568.  dc.w $ffff,$fffe
  16569.  
  16570. Scream:
  16571. ; incbin "ab3:sounds/Scream"
  16572. ; ds.w 100
  16573. EndScream:
  16574. LowScream:
  16575. ; incbin "ab3:sounds/LowScream"
  16576. ; ds.w 100
  16577. EndLowScream:
  16578. BaddieGun:
  16579. ; incbin "ab3:sounds/BaddieGun"
  16580. EndBaddieGun:
  16581. bass:
  16582. ; incbin "ab3:sounds/backbass+drum"
  16583. bassend:
  16584. Shoot:
  16585. ; incbin "ab3:sounds/fire!"
  16586. EndShoot:
  16587. Munch:
  16588. ; incbin "ab3:sounds/munch"
  16589. EndMunch:
  16590. PooGun:
  16591. ; incbin "ab3:sounds/shoot.dm"
  16592. EndPooGun:
  16593. Collect:
  16594. ; incbin "ab3:sounds/collect"
  16595. EndCollect:
  16596. DoorNoise:
  16597. ; incbin "ab3:sounds/newdoor"
  16598. EndDoorNoise:
  16599. Stomp:
  16600. ; incbin "ab3:sounds/footstep3"
  16601. EndStomp:
  16602. SwitchNoise:
  16603. ; incbin "ab3:sounds/switch"
  16604. EndSwitch:
  16605. Reload:
  16606. ; incbin "ab3:sounds/switch1.SFX"
  16607. EndReload:
  16608.  
  16609. CHEATFRAME:
  16610.  dc.b 26,20,33,27,17,12
  16611. ENDCHEAT:
  16612.  
  16613. NoAmmo:
  16614. ; incbin "ab3:sounds/noammo"
  16615. EndNoAmmo:
  16616. Splotch:
  16617. ; incbin "ab3:sounds/splotch"
  16618. EndSplotch:
  16619. SplatPop:
  16620. ; incbin "ab3:sounds/splatpop"
  16621. EndSplatPop:
  16622. Boom:
  16623. ; incbin "ab3:sounds/boom"
  16624. EndBoom:
  16625. Hiss:
  16626. ; incbin "ab3:sounds/newhiss"
  16627. EndHiss:
  16628. Howl1:
  16629. ; incbin "ab3:sounds/howl1"
  16630. EndHowl1:
  16631. Howl2:
  16632. ; incbin "ab3:sounds/howl2"
  16633. EndHowl2:
  16634. Pant:
  16635. ; incbin "ab3:sounds/pant"
  16636. EndPant:
  16637. Whoosh:
  16638. ; incbin "ab3:sounds/whoosh"
  16639. EndWhoosh:
  16640. ROAR:
  16641. ; incbin "ab3:sounds/bigscream"
  16642. EndROAR
  16643. whoosh:
  16644. ; incbin "ab3:sounds/flame"
  16645. Endwhoosh:
  16646.  SECTION music,code_c
  16647.  
  16648. UseAllChannels: dc.w 0
  16649.  
  16650. mt_init:
  16651.     move.l    mt_data,a0
  16652.     move.l    a0,a1
  16653.     add.l    #$3b8,a1
  16654.     moveq    #$7f,d0
  16655.     moveq    #0,d1
  16656. mt_loop:move.l    d1,d2
  16657.     subq.w    #1,d0
  16658. mt_lop2:move.b    (a1)+,d1
  16659.     cmp.b    d2,d1
  16660.     bgt.s    mt_loop
  16661.     dbf    d0,mt_lop2
  16662.     addq.b    #1,d2
  16663.  
  16664.     lea    mt_samplestarts(pc),a1
  16665.     asl.l    #8,d2
  16666.     asl.l    #2,d2
  16667.     add.l    #$43c,d2
  16668.     add.l    a0,d2
  16669.     move.l    d2,a2
  16670.     moveq    #$1e,d0
  16671. mt_lop3:
  16672.     clr.l    (a2)
  16673.     move.l    a2,(a1)+
  16674.     moveq    #0,d1
  16675.     move.w    42(a0),d1
  16676.     asl.l    #1,d1
  16677.     add.l    d1,a2
  16678.     add.l    #$1e,a0
  16679.     dbf    d0,mt_lop3
  16680.  
  16681.     or.b    #$2,$bfe001
  16682.     move.b    #$6,mt_speed
  16683.     clr.w    $dff0a8
  16684.     clr.w    $dff0b8
  16685.     clr.w    $dff0c8
  16686.     clr.w    $dff0d8
  16687.     clr.b    mt_songpos
  16688.     clr.b    mt_counter
  16689.     clr.w    mt_pattpos
  16690.     rts
  16691.  
  16692. mt_end:    clr.w    $dff0a8
  16693.     clr.w    $dff0b8
  16694.     clr.w    $dff0c8
  16695.     clr.w    $dff0d8
  16696.     move.w    #$f,$dff096
  16697.     rts
  16698.  
  16699. mt_music:
  16700.     movem.l    d0-d4/a0-a3/a5-a6,-(a7)
  16701.     move.l    mt_data,a0
  16702.     addq.b    #$1,mt_counter
  16703.     move.b    mt_counter,D0
  16704.     cmp.b    mt_speed,D0
  16705.     blt.s    mt_nonew
  16706.     clr.b    mt_counter
  16707.     bra    mt_getnew
  16708.  
  16709. mt_nonew:
  16710.     lea    mt_voice1(pc),a6
  16711.     lea    $dff0a0,a5
  16712.     bsr    mt_checkcom
  16713.     tst.b UseAllChannels
  16714.     beq mt_endr
  16715.     lea    mt_voice2(pc),a6
  16716.     lea    $dff0b0,a5
  16717.     bsr    mt_checkcom
  16718.      lea    mt_voice3(pc),a6
  16719.     lea    $dff0c0,a5
  16720.     bsr    mt_checkcom
  16721.     lea    mt_voice4(pc),a6
  16722.     lea    $dff0d0,a5
  16723.     bsr    mt_checkcom
  16724.     bra    mt_endr
  16725.  
  16726. mt_arpeggio:
  16727.     moveq    #0,d0
  16728.     move.b    mt_counter,d0
  16729.     divs    #$3,d0
  16730.     swap    d0
  16731.     cmp.w    #$0,d0
  16732.     beq.s    mt_arp2
  16733.     cmp.w    #$2,d0
  16734.     beq.s    mt_arp1
  16735.  
  16736.     moveq    #0,d0
  16737.     move.b    $3(a6),d0
  16738.     lsr.b    #4,d0
  16739.     bra.s    mt_arp3
  16740. mt_arp1:moveq    #0,d0
  16741.     move.b    $3(a6),d0
  16742.     and.b    #$f,d0
  16743.     bra.s    mt_arp3
  16744. mt_arp2:move.w    $10(a6),d2
  16745.     bra.s    mt_arp4
  16746. mt_arp3:asl.w    #1,d0
  16747.     moveq    #0,d1
  16748.     move.w    $10(a6),d1
  16749.     lea    mt_periods(pc),a0
  16750.     moveq    #$24,d7
  16751. mt_arploop:
  16752.     move.w    (a0,d0.w),d2
  16753.     cmp.w    (a0),d1
  16754.     bge.s    mt_arp4
  16755.     addq.l    #2,a0
  16756.     dbf    d7,mt_arploop
  16757.     rts
  16758. mt_arp4:move.w    d2,$6(a5)
  16759.     rts
  16760.  
  16761. mt_getnew:
  16762.     move.l    mt_data,a0
  16763.     move.l    a0,a3
  16764.     move.l    a0,a2
  16765.     add.l    #$c,a3
  16766.     add.l    #$3b8,a2
  16767.     add.l    #$43c,a0
  16768.  
  16769.     moveq    #0,d0
  16770.     move.l    d0,d1
  16771.     move.b    mt_songpos,d0
  16772.     move.b    (a2,d0.w),d1
  16773.     asl.l    #8,d1
  16774.     asl.l    #2,d1
  16775.     add.w    mt_pattpos,d1
  16776.     clr.w    mt_dmacon
  16777.  
  16778.     lea    $dff0a0,a5
  16779.     lea    mt_voice1(pc),a6
  16780.     bsr    mt_playvoice
  16781.     tst.b UseAllChannels
  16782.     beq mt_setdma
  16783.     lea    $dff0b0,a5
  16784.     lea    mt_voice2(pc),a6
  16785.     bsr    mt_playvoice
  16786.     lea    $dff0c0,a5
  16787.     lea    mt_voice3(pc),a6
  16788.     bsr    mt_playvoice
  16789.     lea    $dff0d0,a5
  16790.     lea    mt_voice4(pc),a6
  16791.     bsr    mt_playvoice
  16792.     bra    mt_setdma
  16793.  
  16794. PROTCALC:
  16795. ;    include "ab3:source_4000/protcalc.s"
  16796.     incbin "ab3:includes/protcalc.bin"
  16797. ENDPROTCALC:
  16798.  
  16799. mt_playvoice:
  16800.     move.l    (a0,d1.l),(a6)
  16801.     addq.l    #4,d1
  16802.     moveq    #0,d2
  16803.     move.b    $2(a6),d2
  16804.     and.b    #$f0,d2
  16805.     lsr.b    #4,d2
  16806.     move.b    (a6),d0
  16807.     and.b    #$f0,d0
  16808.     or.b    d0,d2
  16809.     tst.b    d2
  16810.     beq.s    mt_setregs
  16811.     moveq    #0,d3
  16812.     lea    mt_samplestarts(pc),a1
  16813.     move.l    d2,d4
  16814.     subq.l    #$1,d2
  16815.     asl.l    #2,d2
  16816.     mulu    #$1e,d4
  16817.     move.l    (a1,d2.l),$4(a6)
  16818.     move.w    (a3,d4.l),$8(a6)
  16819.     move.w    $2(a3,d4.l),$12(a6)
  16820.     move.w    $4(a3,d4.l),d3
  16821.     tst.w    d3
  16822.     beq.s    mt_noloop
  16823.     move.l    $4(a6),d2
  16824.     asl.w    #1,d3
  16825.     add.l    d3,d2
  16826.     move.l    d2,$a(a6)
  16827.     move.w    $4(a3,d4.l),d0
  16828.     add.w    $6(a3,d4.l),d0
  16829.     move.w    d0,8(a6)
  16830.     move.w    $6(a3,d4.l),$e(a6)
  16831.     move.w    $12(a6),d0
  16832.     move.w d0,$8(a5)
  16833.     bra.s    mt_setregs
  16834. mt_noloop:
  16835.     move.l    $4(a6),d2
  16836.     add.l    d3,d2
  16837.     move.l    d2,$a(a6)
  16838.     move.w    $6(a3,d4.l),$e(a6)
  16839.     move.w    $12(a6),d0
  16840.     move.w d0,$8(a5)
  16841. mt_setregs:
  16842.     move.w    (a6),d0
  16843.     and.w    #$fff,d0
  16844.     beq    mt_checkcom2
  16845.     move.b    $2(a6),d0
  16846.     and.b    #$F,d0
  16847.     cmp.b    #$3,d0
  16848.     bne.s    mt_setperiod
  16849.     bsr    mt_setmyport
  16850.     bra    mt_checkcom2
  16851. mt_setperiod:
  16852.     move.w    (a6),$10(a6)
  16853.     and.w    #$fff,$10(a6)
  16854.     move.w    $14(a6),d0
  16855.     move.w    d0,$dff096
  16856.     clr.b    $1b(a6)
  16857.  
  16858.     move.l    $4(a6),(a5)
  16859.     move.w    $8(a6),$4(a5)
  16860.     move.w    $10(a6),d0
  16861.     and.w    #$fff,d0
  16862.     move.w    d0,$6(a5)
  16863.     move.w    $14(a6),d0
  16864.     or.w    d0,mt_dmacon
  16865.     bra    mt_checkcom2
  16866.  
  16867. mt_setdma:
  16868.      move.w #250,d0
  16869. mt_wait:
  16870.      add.w #1,testchip
  16871.      dbra d0,mt_wait
  16872.     move.w    mt_dmacon,d0
  16873.     or.w    #$8000,d0
  16874.     tst.b UseAllChannels
  16875.     bne.s .splib
  16876.     and.w #%1111111111110001,d0
  16877. .splib
  16878.     move.w    d0,$dff096
  16879.     move.w #250,d0
  16880. mt_wait2:
  16881.     add.w #1,testchip
  16882.     dbra    d0,mt_wait2
  16883.     lea    $dff000,a5
  16884.     tst.b UseAllChannels
  16885.     beq.s noall
  16886.     lea    mt_voice4(pc),a6
  16887.     move.l    $a(a6),$d0(a5)
  16888.     move.w    $e(a6),$d4(a5)
  16889.     lea    mt_voice3(pc),a6
  16890.     move.l    $a(a6),$c0(a5)
  16891.     move.w    $e(a6),$c4(a5)
  16892.     lea    mt_voice2(pc),a6
  16893.     move.l    $a(a6),$b0(a5)
  16894.     move.w    $e(a6),$b4(a5)
  16895. noall:
  16896.     lea    mt_voice1(pc),a6
  16897.     move.l    $a(a6),$a0(a5)
  16898.     move.w    $e(a6),$a4(a5)
  16899.  
  16900.     add.w    #$10,mt_pattpos
  16901.     cmp.w    #$400,mt_pattpos
  16902.     bne.s    mt_endr
  16903. mt_nex:    clr.w    mt_pattpos
  16904.     clr.b    mt_break
  16905.     addq.b    #1,mt_songpos
  16906.     and.b    #$7f,mt_songpos
  16907.     move.b    mt_songpos,d1
  16908. ;    cmp.b    mt_data+$3b6,d1
  16909. ;    bne.s    mt_endr
  16910. ;    move.b    mt_data+$3b7,mt_songpos
  16911. mt_endr:tst.b    mt_break
  16912.     bne.s    mt_nex
  16913.     movem.l    (a7)+,d0-d4/a0-a3/a5-a6
  16914.     rts
  16915.  
  16916. mt_setmyport:
  16917.     move.w    (a6),d2
  16918.     and.w    #$fff,d2
  16919.     move.w    d2,$18(a6)
  16920.     move.w    $10(a6),d0
  16921.     clr.b    $16(a6)
  16922.     cmp.w    d0,d2
  16923.     beq.s    mt_clrport
  16924.     bge.s    mt_rt
  16925.     move.b    #$1,$16(a6)
  16926.     rts
  16927. mt_clrport:
  16928.     clr.w    $18(a6)
  16929. mt_rt:    rts
  16930.  
  16931. CODESTORE: dc.l 0
  16932.  
  16933. mt_myport:
  16934.     move.b    $3(a6),d0
  16935.     beq.s    mt_myslide
  16936.     move.b    d0,$17(a6)
  16937.     clr.b    $3(a6)
  16938. mt_myslide:
  16939.     tst.w    $18(a6)
  16940.     beq.s    mt_rt
  16941.     moveq    #0,d0
  16942.     move.b    $17(a6),d0
  16943.     tst.b    $16(a6)
  16944.     bne.s    mt_mysub
  16945.     add.w    d0,$10(a6)
  16946.     move.w    $18(a6),d0
  16947.     cmp.w    $10(a6),d0
  16948.     bgt.s    mt_myok
  16949.     move.w    $18(a6),$10(a6)
  16950.     clr.w    $18(a6)
  16951. mt_myok:move.w    $10(a6),$6(a5)
  16952.     rts
  16953. mt_mysub:
  16954.     sub.w    d0,$10(a6)
  16955.     move.w    $18(a6),d0
  16956.     cmp.w    $10(a6),d0
  16957.     blt.s    mt_myok
  16958.     move.w    $18(a6),$10(a6)
  16959.     clr.w    $18(a6)
  16960.     move.w    $10(a6),$6(a5)
  16961.     rts
  16962.  
  16963. mt_vib:    move.b    $3(a6),d0
  16964.     beq.s    mt_vi
  16965.     move.b    d0,$1a(a6)
  16966.  
  16967. mt_vi:    move.b    $1b(a6),d0
  16968.     lea    mt_sin(pc),a4
  16969.     lsr.w    #$2,d0
  16970.     and.w    #$1f,d0
  16971.     moveq    #0,d2
  16972.     move.b    (a4,d0.w),d2
  16973.     move.b    $1a(a6),d0
  16974.     and.w    #$f,d0
  16975.     mulu    d0,d2
  16976.     lsr.w    #$6,d2
  16977.     move.w    $10(a6),d0
  16978.     tst.b    $1b(a6)
  16979.     bmi.s    mt_vibmin
  16980.     add.w    d2,d0
  16981.     bra.s    mt_vib2
  16982. mt_vibmin:
  16983.     sub.w    d2,d0
  16984. mt_vib2:move.w    d0,$6(a5)
  16985.     move.b    $1a(a6),d0
  16986.     lsr.w    #$2,d0
  16987.     and.w    #$3c,d0
  16988.     add.b    d0,$1b(a6)
  16989.     rts
  16990.  
  16991. mt_nop:    move.w    $10(a6),$6(a5)
  16992.     rts
  16993.  
  16994.  
  16995. mt_checkcom:
  16996.     move.w    $2(a6),d0
  16997.     and.w    #$fff,d0
  16998.     beq.s    mt_nop
  16999.     move.b    $2(a6),d0
  17000.     and.b    #$f,d0
  17001.     tst.b    d0
  17002.     beq    mt_arpeggio
  17003.     cmp.b    #$1,d0
  17004.     beq.s    mt_portup
  17005.     cmp.b    #$2,d0
  17006.     beq    mt_portdown
  17007.     cmp.b    #$3,d0
  17008.     beq    mt_myport
  17009.     cmp.b    #$4,d0
  17010.     beq    mt_vib
  17011.     move.w    $10(a6),$6(a5)
  17012.     cmp.b    #$a,d0
  17013.     beq.s    mt_volslide
  17014.     rts
  17015.  
  17016. mt_volslide:
  17017.     moveq    #0,d0
  17018.     move.b    $3(a6),d0
  17019.     lsr.b    #4,d0
  17020.     tst.b    d0
  17021.     beq.s    mt_voldown
  17022.     add.w    d0,$12(a6)
  17023.     cmp.w    #$40,$12(a6)
  17024.     bmi.s    mt_vol2
  17025.     move.w    #$40,$12(a6)
  17026. mt_vol2:move.w    $12(a6),d0
  17027.     move.w d0,$8(a5)
  17028.     rts
  17029.  
  17030. mt_voldown:
  17031.     moveq    #0,d0
  17032.     move.b    $3(a6),d0
  17033.     and.b    #$f,d0
  17034.     sub.w    d0,$12(a6)
  17035.     bpl.s    mt_vol3
  17036.     clr.w    $12(a6)
  17037. mt_vol3:move.w    $12(a6),d0
  17038.     move.w d0,$8(a5)
  17039.     rts
  17040.  
  17041. mt_portup:
  17042.     moveq    #0,d0
  17043.     move.b    $3(a6),d0
  17044.     sub.w    d0,$10(a6)
  17045.     move.w    $10(a6),d0
  17046.     and.w    #$fff,d0
  17047.     cmp.w    #$71,d0
  17048.     bpl.s    mt_por2
  17049.     and.w    #$f000,$10(a6)
  17050.     or.w    #$71,$10(a6)
  17051. mt_por2:move.w    $10(a6),d0
  17052.     and.w    #$fff,d0
  17053.     move.w    d0,$6(a5)
  17054.     rts
  17055.  
  17056. mt_portdown:
  17057.     clr.w    d0
  17058.     move.b    $3(a6),d0
  17059.     add.w    d0,$10(a6)
  17060.     move.w    $10(a6),d0
  17061.     and.w    #$fff,d0
  17062.     cmp.w    #$358,d0
  17063.     bmi.s    mt_por3
  17064.     and.w    #$f000,$10(a6)
  17065.     or.w    #$358,$10(a6)
  17066. mt_por3:move.w    $10(a6),d0
  17067.     and.w    #$fff,d0
  17068.     move.w    d0,$6(a5)
  17069.     rts
  17070.  
  17071. mt_checkcom2:
  17072.     move.b    $2(a6),d0
  17073.     and.b    #$f,d0
  17074.     cmp.b    #$e,d0
  17075.     beq.s    mt_setfilt
  17076.     cmp.b    #$d,d0
  17077.     beq.s    mt_pattbreak
  17078.     cmp.b    #$b,d0
  17079.     beq.s    mt_posjmp
  17080.     cmp.b    #$c,d0
  17081.     beq.s    mt_setvol
  17082.     cmp.b    #$f,d0
  17083.     beq.s    mt_setspeed
  17084.     rts
  17085.  
  17086. mt_setfilt:
  17087.     move.b    $3(a6),d0
  17088.     and.b    #$1,d0
  17089.     asl.b    #$1,d0
  17090.     and.b    #$fd,$bfe001
  17091.     or.b    d0,$bfe001
  17092.     rts
  17093. mt_pattbreak:
  17094.     not.b    mt_break
  17095.     rts
  17096. mt_posjmp:
  17097.     st reachedend
  17098.     move.b    $3(a6),d0
  17099.     subq.b    #$1,d0
  17100.     move.b    d0,mt_songpos
  17101.     not.b    mt_break
  17102.     rts
  17103. mt_setvol:
  17104.     cmp.b    #$40,$3(a6)
  17105.     ble.s    mt_vol4
  17106.     move.b    #$40,$3(a6)
  17107. mt_vol4:move.b    $3(a6),d0
  17108.     move.w d0,$8(a5)
  17109.     rts
  17110. mt_setspeed:
  17111.     cmp.b    #$1f,$3(a6)
  17112.     ble.s    mt_sets
  17113.     move.b    #$1f,$3(a6)
  17114. mt_sets:move.b    $3(a6),d0
  17115.     beq.s    mt_rts2
  17116.     move.b    d0,mt_speed
  17117.     clr.b    mt_counter
  17118. mt_rts2:rts
  17119.  
  17120. mt_sin:
  17121.  DC.b $00,$18,$31,$4a,$61,$78,$8d,$a1,$b4,$c5,$d4,$e0,$eb,$f4,$fa,$fd
  17122.  DC.b $ff,$fd,$fa,$f4,$eb,$e0,$d4,$c5,$b4,$a1,$8d,$78,$61,$4a,$31,$18
  17123.  
  17124. mt_periods:
  17125.  DC.w $0358,$0328,$02fa,$02d0,$02a6,$0280,$025c,$023a,$021a,$01fc,$01e0
  17126.  DC.w $01c5,$01ac,$0194,$017d,$0168,$0153,$0140,$012e,$011d,$010d,$00fe
  17127.  DC.w $00f0,$00e2,$00d6,$00ca,$00be,$00b4,$00aa,$00a0,$0097,$008f,$0087
  17128.  DC.w $007f,$0078,$0071,$0000,$0000
  17129.  
  17130. reachedend: dc.b 0
  17131. mt_speed:    DC.b    6
  17132. mt_songpos:    DC.b    0
  17133. mt_pattpos:    DC.w    0
  17134. mt_counter:    DC.b    0
  17135.  
  17136. mt_break:    DC.b    0
  17137. mt_dmacon:    DC.w    0
  17138. mt_samplestarts:DS.L    $1f
  17139. mt_voice1:    DS.w    10
  17140.         DC.w    1
  17141.         DS.w    3
  17142. mt_voice2:    DS.w    10
  17143.         DC.w    2
  17144.         DS.w    3
  17145. mt_voice3:    DS.w    10
  17146.         DC.w    4
  17147.         DS.w    3
  17148. mt_voice4:    DS.w    10
  17149.         DC.w    8
  17150.         DS.w    3
  17151.  
  17152. PLR1_dead: dc.w 0
  17153. PLR2_dead: dc.w 0
  17154. PLR3_dead: dc.w 0
  17155.  
  17156. CHEATPTR: dc.l 0
  17157. CHEATNUM: dc.l 0
  17158.  
  17159. testchip: dc.w 0
  17160.  
  17161. LEVELMUSIC: dc.l 0
  17162.  
  17163. ;/* End of File */
  17164. mt_data: dc.l 0
  17165. tstchip: dc.l 0
  17166.  include "SERIAL_NIGHTMARE"
  17167.  
  17168. ingame:
  17169. ; incbin "work:temp/newmusic/testonechan"
  17170. gameover: 
  17171. ;incbin "ab3:includes/gameover"
  17172. welldone: incbin "ab3:includes/quietwelldone"
  17173.  
  17174.  
  17175.